CKAD field manual

k8s livenessProbe YAML example

Probes live on the container. kubectl run cannot set them — dry-run, edit, apply.

An officer kneels and probes a fighter in a hangar at sunset. An officer kneels and probes a fighter in a hangar at sunset.
httpGet
apiVersion: v1
kind: Pod
metadata:
  name: web
spec:
  containers:
    - name: web
      image: nginx:1.27
      ports:
        - containerPort: 80
      startupProbe:
        httpGet:
          path: /
          port: 80
        failureThreshold: 30
        periodSeconds: 2
      livenessProbe:
        httpGet:
          path: /healthz
          port: 80
        initialDelaySeconds: 5
        periodSeconds: 10
      readinessProbe:
        httpGet:
          path: /ready
          port: 80
        periodSeconds: 5
exec
livenessProbe:
  exec:
    command: ["cat", "/tmp/healthy"]
  periodSeconds: 10
tcpSocket
readinessProbe:
  tcpSocket:
    port: 3306
  periodSeconds: 5

Fields

startupProbe
Runs first. liveness and readiness wait until this succeeds.
livenessProbe
Fail → kubelet restarts the container.
readinessProbe
Fail → Pod stays up, dropped from Service endpoints.
httpGet
path must start with /.

Watch

  • startupProbe runs first. liveness and readiness wait until it succeeds.
  • readiness fail → Pod stays up, dropped from Service endpoints. liveness fail → container restarts.
  • httpGet.path must start with /. port is a number or a named containerPort.

Official docs Probes

Practice these objects on a live cluster →