Cloud Fortgeschritten
Kubernetes Debugging¶
KubernetesDebuggingTroubleshooting 3 Min. Lesezeit
Problembehandlung in Kubernetes. Kubectl-Befehle, Events, Logs und Ephemeral Containers.
Grundlegendes Debugging¶
# Pod-Status und Events
kubectl describe pod myapp-xyz
kubectl get events --sort-by='.lastTimestamp'
# Logs
kubectl logs myapp-xyz
kubectl logs myapp-xyz --previous # Nach CrashLoopBackOff
kubectl logs -l app=myapp --all-containers
# Shell in den Container
kubectl exec -it myapp-xyz -- sh
# Ephemeral Debug Container
kubectl debug -it myapp-xyz --image=busybox
Häufige Probleme¶
- CrashLoopBackOff — Prüfung mit logs –previous
- ImagePullBackOff — falscher Image-Name oder Registry-Auth
- Pending — Ressourcenmangel (kubectl describe)
- OOMKilled — Memory-Limit erhöhen
Fortgeschritten¶
# Network Debugging
kubectl run debug --image=nicolaka/netshoot -it --rm -- bash
# DNS-Test
nslookup my-service.default.svc.cluster.local
# Port Forward
kubectl port-forward svc/myservice 8080:80
Zusammenfassung¶
kubectl describe und logs lösen 80 % der Probleme. Für Netzwerkprobleme verwenden Sie das netshoot-Image.
Brauchen Sie Hilfe bei der Implementierung?¶
Unser Team hat Erfahrung mit dem Entwurf und der Implementierung moderner Architekturen. Wir helfen Ihnen gerne.