Build and Deploy the Java microservices
To begin, make sure your Kubernetes environment is set up by running the following command:
You should now see the versions of your kubectl client and cluster. If so, your environment is all set up. If you do not see the version of your Kubernetes server wait a few moments and repeat the previous command until it is shown.
Now you need to navigate into the projects directory that has been provided for you. You may notice their is a finish directory. This contains the finished code that you will not require for this tutorial.
The two microservices you will deploy are called name and ping. The name microservice displays a brief greeting with the name of the container that contains the application. The ping microservice pings the Kubernetes Service that encapsulates the pod running the name microservice. The ping microservice demonstrates how communication can be established between pods inside a cluster. To build the applications with Maven, run the following commands;
mvn package -pl name
mvn package -pl ping
Once the services have been built, you need to deploy them to Kubernetes. To do this use the following command:
kubectl apply -f kubernetes.yaml