Topics Discussed:
- DebuggingaPod in init State
- Debugging CrashLoopBackOff:
- Tools for In-Cluster Service Troubleshooting
1. Debugging a Pod in init State:
– Issue: The Pod remains in the initialized state.
-Symptom: A Pod remains in the initialization state and doesn’t progress
– Steps:
– Check the Pods in the specific namespace: kubectl get pods -n <namespace>.
– Describe the Pod to see detailed info: kubectl describe po <podname> -n <namespace>.
– If the issue is with the init container, inspect the logs: kubectl logs <podname> -n
<namespace> -c <containername>.
– Solution: Ensure dependencies like services the init container checks for are running.
2. Debugging CrashLoopBackOff:
– Issue: Pod restarts repeatedly due to errors.
-Symptom: A Pod is in a repeated restart loop due to underlying errors.
– Steps:
– Investigate the logs of the problematic Pod.
– Confirm environment variables, config files, and network connections.
– Solution: Correct any configuration mistakes and apply changes.
3. Tools for In-Cluster Service Troubleshooting:
a. Kubeshark:
– Purpose: Analyze real-time API traffic within a namespace.
– Usage:
– Initiate traffic analysis: kubeshark tap -n <namespace>.
– Clean up post-analysis: kubeshark clean.
b. Telepresence:
– Purpose: Debug Kubernetes services locally, while keeping other services operational
inside the cluster.
– Usage:
– Connect to the cluster: telepresence connect.
– List services: telepresence list -n <namespace>.
– Divert traffic from a service to local system: telepresence intercept <podname> –port
5000:80 -n <namespace>.
Additional Notes:
– A Pod is the smallest unit in Kubernetes, capable of hosting multiple containers.
– Init containers run before application containers and are used to set up the conditions the
application requires or serve to prepare the environment or conditions that the main application
containers need.
– Always start troubleshooting by describing the problematic resource (pod/service) to get
detailed information about its state.
-Ensure you have the correct configurations and that dependent services are running before
deploying a new service.