Deploying Stateless Microservices: Introduction
Post-Deployment Checks: Status, Events, and Logs
After creating the Deployment, it's always a good idea to check the status of the different objects we created, the system events, and the logs of the application.
To do this, we can start by checking the status of the Deployment, ReplicaSet, and Pods using the kubectl get command:
# Check the status of the Deployment
kubectl get deployment -n stateless-flask
# Check the status of the ReplicaSet
kubectl get rs -n stateless-flask
# Check the status of the Pods
kubectl get pods -n stateless-flask
Let's take a closer look at the output of kubectl get pods -n stateless-flask:
NAME READY STATUS RESTARTS AGE
stateless-flask-74854dc7f5-8j6qs 1/1 Running 0 2m58s
stateless-flask-74854dc7f5-bwvnv 1/1 Running 0 2m58s
stateless-flask-74854dc7f5-xfw68 1/1 Running 0 2m58s
The
NAMEcolumn shows the names of the Pods. Each Pod name is a combination of the Deployment name, a unique identifier for the ReplicaSet, and a unique identifier for the Pod itself:.- - The
1/1in theREADYcolumn indicates that the Pod is running and ready to serve requests. This value means that one out of one container in the Pod is ready.The
STATUScolumn shows the current status of the Pod, which should beRunning.The
RESTARTScolumn indicates how many times the Pod has been restarted, which should be0if everything is working correctly.The
AGEcolumn shows how long the Pod has been running.
We can then move on to using the kubectl describe command, which is similar to docker inspect and provides detailed information about a specific Kubernetes object.
Describe the Deployment:
kubectl describe deployment stateless-flask -n stateless-flask
Describe the ReplicaSet:
kubectl describe rs -n stateless-flask
Describe a Pod:
# Get the name of the Pod using jsonpath
POD_NAME=$(kubectl get pods -n stateless-flask -o jsonpath=Cloud-Native Microservices With Kubernetes - 2nd Edition
A Comprehensive Guide to Building, Scaling, Deploying, Observing, and Managing Highly-Available Microservices in KubernetesEnroll now to unlock all content and receive all future updates for free.
