Kubernetes Troubleshooting:
Troubleshooting in Kubernetes->
Troubleshooting in Kubernetes may be difficult because of it's distributed nature and complexity. But there are many commands, tools and technique that can help to troubleshoot or solve problem in Kubernetes cluster.
Firstly we need to understand few things for troubleshoot in cluster.
a. Understanding the problem- What are the expected behavior, what are the actual behavior, when the problem started, what are the Pod, service other components are affected.
b. Basic tools for troubleshoot- kubectl, logs, events, describe.
kubectl- A command line tool to interact with Kubernetes cluster.
Logs- Access logs for pods, containers, or other components.
Events- To see what actions are taken in cluster by system.
Describe- Getting detailed information about resources.
Troubleshooting Pod->
Checking pod status with below command- To check is it running, pending, crashLoopBackOff
kubectl get pods -n <namespace>
Describe pod- provides details of pod
kubectl describe pod <pod-name> -n <namespace>
Check pod log-
kubectl logs <pod-name> -n <namespace>
Troubleshooting Deployment->
Check deployment status-
kubectl get deployment <deployment name> -n <namespace>
Describe the deployment-
kubectl describe deployment <deployment-name> -n <namepspace>
Check replicaSet- If the pods are not created as expected
kubectl get rs -n <namespace>
kubectl describe rs <replicaset-name> -n <namespace>
Troubleshoot service->
Check service status-
kubectl get svc -n <namespace>
Describe service-
kubectl describe service <service namme> -n <namespace>
Verify endpoint- That is to make sure service is correctly mapped with correct pod IPS
kubectl get endpoint <service name> -n <namespace>
Troubleshooting Node->
Check node status-
kubectl get node
Describe Node-
kubectl describe node <node-name>
Check system logs-
journalctl -u kubelet
Subscribe to my newsletter
Read articles from Ankit Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by