AskLearn
Loading...
← Back to Course
Advanced

Troubleshooting

Common issues and debugging

Troubleshooting

Common Commands

# Get detailed pod information
kubectl describe pod <pod-name>

# Check events
kubectl get events --sort-by=.metadata.creationTimestamp

# Debug pod networking
kubectl exec -it <pod-name> -- nslookup kubernetes.default

# Check resource usage
kubectl top nodes
kubectl top pods

# Get cluster info
kubectl cluster-info dump

Common Issues and Solutions

1. Pod Stuck in Pending

  • Check node resources: kubectl describe nodes
  • Check pod requirements vs available resources
  • Verify image pull secrets if using private images

2. Pod CrashLoopBackOff

  • Check logs: kubectl logs <pod-name> --previous
  • Verify container health checks
  • Check resource limits

3. Service Not Accessible

  • Verify service selector matches pod labels
  • Check endpoints: kubectl get endpoints <service-name>
  • Test connectivity from another pod

4. Image Pull Errors

  • Verify image name and tag
  • Check image pull secrets
  • Ensure image exists in registry

Next Steps

Review Certification Tips if you're preparing for Kubernetes certifications.