Readiness Probe — check if application is ready to receive traffic.
1apiVersion: apps/v12kind: Deployment3metadata:4 name: myapp5spec:6 replicas: 37 template:8 spec:9 containers:10 - name: app11 image: myapp:latest12 readinessProbe:13 httpGet:14 path: /ready15 port: 808016 httpHeaders:17 - name: X-Readiness18 value: "check"19 initialDelaySeconds: 520 periodSeconds: 1021 timeoutSeconds: 322 successThreshold: 123 failureThreshold: 324---25# TCP readiness probe26apiVersion: apps/v127kind: Deployment28metadata:29 name: myapp-tcp30spec:31 template:32 spec:33 containers:34 - name: app35 image: myapp:latest36 readinessProbe:37 tcpSocket:38 port: 808039 initialDelaySeconds: 540 periodSeconds: 1041---42# Exec readiness probe43apiVersion: apps/v144kind: Deployment45metadata:46 name: myapp-exec47spec:48 template:49 spec:50 containers:51 - name: app52 image: myapp:latest53 readinessProbe:54 exec:55 command:56 - sh57 - -c58 - "curl -f http://localhost:8080/ready || exit 1"59 initialDelaySeconds: 560 periodSeconds: 10
1# Check readiness probe2kubectl describe pod my-pod | grep -A 10 "readinessProbe"34# Check Pod ready condition5kubectl get pod my-pod -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}'67# Check endpoint inclusion8kubectl get endpoints myapp910# Verify readiness11kubectl get pods -o wide | grep myapp1213# Check probe logs14kubectl logs my-pod --previous1516# Verify readiness endpoint17kubectl exec my-pod -- curl -s http://localhost:8080/ready
Behavior:
Use cases: