Where do liveness probes go in a deployment spec?

Prepare for the Red Hat Openshift Developer EX288 Exam. Study with comprehensive quizzes and flashcards. Each question includes hints and explanations to enhance your understanding. Ace your exam with confidence!

Multiple Choice

Where do liveness probes go in a deployment spec?

Explanation:
Liveness probes are defined for each container inside the Pod spec, which sits inside the Pod template of the Deployment. In other words, you place the livenessProbe under the container entry within the Deployment’s pod template: spec.template.spec.containers[].livenessProbe. Each container can have its own probe configuration, so if you have multiple containers, you’d add a livenessProbe to each relevant container. Example in concept: within a container definition, you might specify livenessProbe: httpGet: path: /health port: 8080 initialDelaySeconds: 30 periodSeconds: 10 This placement ensures Kubernetes checks the container’s health after the pod is created, and restarts the container if the probe fails. Why the other placements don’t fit: the top-level spec of a Deployment describes deployment-level settings, not per-container health checks; the Pod spec lives under template.spec, so the correct location must include both template and spec before converging on containers[]. livenessProbe is a field of the container, not a separate status or other non-container path.

Liveness probes are defined for each container inside the Pod spec, which sits inside the Pod template of the Deployment. In other words, you place the livenessProbe under the container entry within the Deployment’s pod template: spec.template.spec.containers[].livenessProbe. Each container can have its own probe configuration, so if you have multiple containers, you’d add a livenessProbe to each relevant container.

Example in concept: within a container definition, you might specify

livenessProbe:

httpGet:

path: /health

port: 8080

initialDelaySeconds: 30

periodSeconds: 10

This placement ensures Kubernetes checks the container’s health after the pod is created, and restarts the container if the probe fails.

Why the other placements don’t fit: the top-level spec of a Deployment describes deployment-level settings, not per-container health checks; the Pod spec lives under template.spec, so the correct location must include both template and spec before converging on containers[]. livenessProbe is a field of the container, not a separate status or other non-container path.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy