Question 38
Domain 1: Application Design and BuildWhich Pod specification correctly defines an exec-based liveness probe that checks for /tmp/healthy in namespace q43?
Correct answer: A
Explanation
The Pod spec matches an exec-based liveness probe because it uses "livenessProbe" with "exec" and the command "cat /tmp/healthy," which checks the file’s presence inside the container. The container command "touch /tmp/healthy; sleep 3600" creates that file, and the probe timing is set with "initialDelaySeconds: 5" and "periodSeconds: 10" in namespace q43.
Why each option is right or wrong
A. A Pod named liveness-exec-pod in namespace q43 using image busybox:latest, running sh -c "touch /tmp/healthy; sleep 3600", with a livenessProbe exec command cat /tmp/healthy, initialDelaySeconds: 5, periodSeconds: 10
Kubernetes defines an exec liveness probe under `livenessProbe.exec.command`, and the probe succeeds only when the command exits with status 0; here, `cat /tmp/healthy` is a valid file-presence check because it returns 0 only if the file exists. The container’s startup command `sh -c "touch /tmp/healthy; sleep 3600"` creates that file and keeps the container alive long enough for the probe to run, while `initialDelaySeconds: 5` and `periodSeconds: 10` are valid probe timing fields in the Pod spec. The namespace is explicitly set to `q43`, so the manifest matches the question’s required scope.
B. A Pod named liveness-exec-pod in namespace q43 using image busybox:latest, running sh -c "touch /tmp/healthy; sleep 3600", with a readinessProbe exec command cat /tmp/healthy, initialDelaySeconds: 5, periodSeconds: 10
C. A Pod named liveness-exec-pod in namespace q43 using image busybox:latest, running sh -c "sleep 3600", with a livenessProbe httpGet on /tmp/healthy, initialDelaySeconds: 5, periodSeconds: 10
D. A Pod named liveness-exec-pod in namespace q43 using image busybox:latest, running sh -c "touch /tmp/healthy; sleep 3600", with a livenessProbe exec command test -f /tmp/healthy, initialDelaySeconds: 1, periodSeconds: 5