To build these microservices, navigate to the
start directory and run the following command.
When the build succeeds, run the following command to deploy the necessary Kubernetes resources to serve the applications.
kubectl apply -f kubernetes.yaml
Use the following command to view the status of the pods. There will be two
name pods and one
ping pod, later you’ll observe their behaviour as the
name pods become unhealthy.
NAME READY STATUS RESTARTS AGE
name-deployment-694c7b74f7-hcf4q 1/1 Running 0 59s
name-deployment-694c7b74f7-lrlf7 1/1 Running 0 59s
ping-deployment-cf8f564c6-nctcr 1/1 Running 0 59s
Wait until the pods are ready. After the pods are ready, you will make requests to your services.
http://[hostname]:31000/api/name and observe a response similar to
Hello! I’m container name-deployment-5f868854bf-2rhdq. Replace
[hostname] with the IP address or host name of your Kubernetes cluster. The readiness probe ensures the READY state won’t be
1/1 until the container is available to accept requests. Without a readiness probe, you may notice an unsuccessful response from the server. This scenario can occur when the container has started, but the application server hasn’t fully initialized. With the readiness probe, you can be certain the pod will only accept traffic when the microservice has fully started.
Similarly, navigate to
http://[hostname]:32000/api/ping/name-service and observe a response with the content