K8s troubleshooting commands most common interview QnA 

1. CrashLoopBackOff State

 Check Pod Logs: kubectl logs

 Inspect Pod YAML: kubectl get pod -o yaml

 Examine Container Images: kubectl describe pod

2. Image Pull Back Off

 Verify Image Existence: docker images

 Check Registry Credentials: kubectl describe secret <registry-secret-name>

3. Services Latency

 Monitor Metrics: kubectl top pod <pod-name> || kubectl top node

 Review Service Configuration: kubectl describe service <registry-secret-name>

4. Deployment Failed

 Increase Resource Requests: kubectl edit deployment <deployment-name>

 Check Cluster Capacity: kubectl cluster-info

5. Node Failures

 Monitor Node Health: kubectl get nodes

 Check Node Logs: kubectl logs kubelet <node-name>

6. Out of bounds PersistentVolumeClaim (PVC)

 Verify PV Availability: kubectl get pv

 Check PV Annotations: kubectl describe pv <pv-name>

 Inspect StorageClass: kubectl get storageclass

7. Networking among pods

 Check Network Policies: kubectl get networkpolicy

 Inspect Pod Labels and Selectors: kubectl describe pod <pod-name>

 Test Network Connectivity: kubectl exec -- ping <other-pod-name>

8. API Server Slowness

 Check API Server Logs: journalctl -u kube-apiserver

 Monitor Resource Usage: kubectl top node <node-name>

9. Cluster Components Unresponsive
 Check Component Logs:
journalctl -u kube-scheduler
journalctl -u kube-controller-manager

10. AutoScaling issues

 Verify HPA Configuration: kubectl describe hpa <hpa-name>

 Monitor Pod Metrics: kubectl top pod <node-name>

    Leave a Comment