Kubernetes + Docker + Spring boot + Fabric8 Maven plugin – in a nutshell


Lead Software Engineer

Kubernetes + Docker + Spring boot + Fabric8 Maven plugin – in a nutshell

Microservices. How could we concisely illustrate architecture of microservices? Let’s refer to Roerich Banner Of Peace picture: wikipedia

Here you can see the idea. The awesome tool to implement self-healing circle is Kubernetes. To conduct kubernetes kubectl command line tool is indented to be used. Plus there is fabric8 maven plugin to facilitate Java developers to work with kubernetes.

Kubernetes is awesome tool but there is a gap between skills that should be applied to run kubernetes cluster and general Java developer skills. From this point kubernetes could be treated as a tool to be used by devops experts.

Hopefully, there are tools which greatly simplify deployment of kubernetes cluster under developers machines. One of those tools is minikube. This allows us to quickly run Kubernetes single node cluster. Hopefully, by the end of this article reading you will manage to:

– run kubernetes cluster
– develop simple Spring boot microservices
– deploy microservices into kubernetes by using fabric8 maven plugin ot kubectl tool- scale particular service


1. Windows machine with Oracle VM installed + Maven
2. Refer to: github.com
3. In my case I downloaded the binaries: kubectl.exe, minikube.exe
4. And added them to PATH:


1) Create a single node Kubernetes cluster.
You should execute: minikube start –host-only-cidr=”″
(–host-only-cidr=”″) this is for correct minikubeVM configuration: NAT (to provide IP address to be accessed from window machine) + Host-only adapter.
After this command has been executed, a minikubeVM ready-for-use is produced (running under CoreOS). A virtual machine is created automatically.

2) Execute the minikube ip – to discover the address of the Kubernetes machine (or you could login to the virtual machine and execute: ifconfig)

3) Kubernetes + Docker machine has been just created.
4) Some local hacks to be performed: Take config file from:
And place it somewhere you feel is convenient (e.g. I placed it under the root of D:/). We should use this file to execute kubectl commands.

5) E.g. refer to the classic Spring boot example: github
Plus, we should add a Fabric8 plugin to pom.xml

6) Now we can build the project and build a Docker image on the host where Kubernetes + Docker is being run.
At first you should set:
SET DOCKER_HOST=tcp:// SET DOCKER_CERT_PATH=C:\Users\Maxim_Surov.minikube\certs (this variable have to be set up only if kubernetes cluster is being accessed via SSL)
You can discover those params by executing:
Then build:
mvn clean install fabric8:build
It should create an executable Spring boot jar + create a Docker image on the remote host.
If we execute: <> on Kubernetes + Docker host we should see that a springframework/gs-spring-boot-docker image has been created.
Now it’s time to deploy the image into Kubernetes. From the Windows host execute consecutively
kubectl run gs-spring-boot-docker –image=springframework/gs-spring-boot-docker:0.1.0 –port=8080 –replicas=3
kubectl expose replicationController gs-spring-boot-docker –type=NodePort –external-ip=
kubectl describe services gs-spring-boot-docker
kubectl get pods
alternative approach is just to use fabric8 maven plugin commands to accomplish it, e.g.:
mvn clean install fabric8:build fabric8:run
to scale:
mvn fabric8:start -Dfabric8.replicas=3
By default service that has one pod is created
if e.g. service has been scaled to 3 replicas the output is:
We have just set up single node 3 replicas (SLA) kubernetes cluster. You can see that all replicas are run.
To execute it externally we should use: Or it could have been configured to use also 8080 port.
As you can see, different replicas play periodically.
Other useful commands:
get pods --kubeconfig="d:/config"
get nodes --kubeconfig="d:/config"
get services --kubeconfig="d:/config"
kubectl cluster-info --kubeconfig="d:/config" You can also leverage different capabilities of fabric8 maven plugin (https://maven.fabric8.io/)


You have just managed to run single node kubernetes cluster. Plus, you can communicate with it to deploy, scale, etc services by using fabric8 maven plugin. From docker perspectives there is counterpart of fabric8 maven plugin. It is called: com.spotify (docker-maven-plugin) though it is also powerfull it is indented to work only with docker, To work with kubernetes you should rely on fabric8 maven plugin. Thank you for reading. I wanted to share this knowledge and approach. Since I spent a lot of time trying to set up kubernetes (with Ubuntu, etc). It seems it is the most comfortable solution (for general Java developer not for linux guy) just to try locally.