Kubernetes

Perhaps a general question but, you suspect one of the pods is having issues, you don't know what exactly. What do you do?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

Start by inspecting the pods status. we can use the command kubectl get pods (--all-namespaces for pods in system namespace)

If we see "Error" status, we can keep debugging by running the command kubectl describe pod [name]. In case we still don't see anything useful we can try stern for log tailing.

In case we find out there was a temporary issue with the pod or the system, we can try restarting the pod with the following kubectl scale deployment [name] --replicas=0

Setting the replicas to 0 will shut down the process. Now start it with kubectl scale deployment [name] --replicas=1