05 Health Probes
Dieses Lab zeigt eine kleine Webanwendung mit startupProbe, readinessProbe und livenessProbe.
Prüfen
kubectl apply --dry-run=client -f manifests/
Ausführung
kubectl apply -f manifests/
kubectl rollout status deployment/probe-web -n probes-lab
kubectl get pods -n probes-lab
kubectl describe pod -n probes-lab -l app.kubernetes.io/name=probe-web
kubectl port-forward -n probes-lab svc/probe-web 8080:80
Danach ist die Anwendung lokal unter http://localhost:8080 erreichbar.
Lernpunkte
startupProbeschützt langsam startende Container vor verfrühten Neustarts.readinessProbeentscheidet, ob ein Pod Service-Traffic bekommt.livenessProbeerkennt hängende Container und löst Neustarts aus.- Benannte Ports machen Probes und Services lesbarer als nackte Portnummern.
Cleanup
kubectl delete namespace probes-lab
Quelle
Orientiert an der offiziellen Kubernetes-Dokumentation zu Liveness-, Readiness- und Startup-Probes: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/