nerdexam
Linux_Foundation

CKAD · Question #6

A pod is running on the cluster but it is not responding. The desired behavior is to have Kubernetes restart the pod when an endpoint returns an HTTP 500 on the /healthz endpoint. The service…

Configure HTTP liveness and readiness probes for a Kubernetes pod using the specified paths and port to ensure application health and proper traffic routing.

Submitted by klara.se· May 4, 2026Application Observability and Maintenance

Question

A pod is running on the cluster but it is not responding. The desired behavior is to have Kubernetes restart the pod when an endpoint returns an HTTP 500 on the /healthz endpoint. The service, probe-pod, should never send traffic to the pod while it is failing. Please complete the following: The application has an endpoint, /, started, that will indicate if it can accept traffic by returning an HTTP 200. If the endpoint returns an HTTP 500, the application has not yet finished initialization. The application has another endpoint /healthz that will indicate if the application is still working as expected by returning an HTTP 200. If the endpoint returns an HTTP 500 the application is no longer responsive. Configure the probe-pod pod provided to use these endpoints. The probes should use port 8080

Exhibit

CKAD question #6 exhibit

Explanation

Configure HTTP liveness and readiness probes for a Kubernetes pod using the specified paths and port to ensure application health and proper traffic routing.

Approach. The correct interaction is to insert the readinessProbe and livenessProbe configuration blocks within the spec.containers[0] section of the provided YAML file, specifically as siblings to existing container properties like image, name, and env. This involves adding the following lines with proper indentation (4 spaces per level):

    readinessProbe:
      httpGet:
        path: /
        port: 8080
    livenessProbe:
      httpGet:
        path: /healthz
        port: 8080

Reasoning for the configuration:

  1. Readiness Probe: The question states, 'The application has an endpoint, /, started, that will indicate if it can accept traffic by returning an HTTP 200.' and 'The service, probe-pod, should never send traffic to the pod while it is failing.' This indicates that the / endpoint should be used for the readiness probe on port 8080. When this probe fails (e.g., returns HTTP 500 indicating the application has not yet finished initialization), Kubernetes will remove the pod from the service endpoints, preventing traffic from being sent to it until it's truly ready.
  2. Liveness Probe: The question states, 'The desired behavior is to have Kubernetes restart the pod when an endpoint returns an HTTP 500 on the /healthz endpoint.' and 'The application has another endpoint /healthz that will indicate if the application is still working as expected by returning an HTTP 200.' This indicates that the /healthz endpoint should be used for the liveness probe on port 8080. When this probe fails (e.g., returns HTTP 500 indicating the application is no longer responsive), Kubernetes will restart the container to attempt recovery.
  3. Port 8080: Both probes explicitly specify using port 8080 in the question requirements.

Common mistakes.

  • common_mistake. 1. Swapping Liveness and Readiness Probes: A very common mistake is to misinterpret the roles of the endpoints and assign / to the liveness probe and /healthz to the readiness probe. The question clearly links / to 'can accept traffic' (readiness) and /healthz to 'still working as expected'/'no longer responsive' (liveness).
  1. Incorrect Paths or Port: Using incorrect paths (e.g., /status instead of / or /health instead of /healthz) or a different port (e.g., 80 or 443) would fail to meet the specific requirements of the question.
  2. Incorrect Probe Type: Specifying exec (for running a command) or tcpSocket (for checking a TCP connection) instead of httpGet (for HTTP endpoints) is incorrect, as the problem describes HTTP status codes.
  3. YAML Indentation Errors: YAML is highly sensitive to indentation. Incorrect spacing (e.g., tabs instead of spaces, or wrong number of spaces) will lead to an invalid YAML file and prevent the pod configuration from being applied.
  4. Missing httpGet Key: Forgetting to include the httpGet key and directly placing path and port under readinessProbe or livenessProbe is a common syntax error for HTTP probes.

Concept tested. Kubernetes Liveness and Readiness Probes. This includes understanding their distinct purposes (liveness for container restart policy, readiness for service traffic routing), how to configure HTTP GET probes, and correctly specifying paths and ports within the Kubernetes Pod YAML definition.

Reference. https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/

Topics

#Liveness Probes#Readiness Probes#Pod Configuration#HTTP Probes

Community Discussion

No community discussion yet for this question.

Full CKAD Practice