Courseiva
Application Observability and MaintenancemediumMultiple ChoiceObjective-mapped

CKAD Application Observability and Maintenance Practice Question

You need to configure a liveness probe for a container that starts a web server on port 8080. The probe should check the '/healthz' endpoint. Which YAML snippet correctly defines this probe?

⚠ Common exam trap

Watch out — candidates often choose a `tcpSocket` probe (option D) thinking it's sufficient for a web server, but the CKAD exam expects you to use an `httpGet` probe with the correct path to validate the application's health endpoint.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

livenessProbe:\n httpGet:\n path: /healthz\n port: 8080

It defines an HTTP GET liveness probe that checks the '/healthz' endpoint on port 8080, which is the standard way to verify the health of a web server. The `httpGet` probe sends an HTTP GET request to the specified path and port, and the container is considered healthy if the response status code is between 200 and 399.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • livenessProbe:\n exec:\n command: ["curl", "http://localhost:8080/healthz"]

    Why it's wrong here

    This is an exec probe, not an httpGet probe, so it violates the explicit requirement. The kubelet would run the curl command inside the container and treat exit code 0 as healthy, which means the image must contain both a shell and curl; many distroless images do not, leading to false failures. Even if curl is available, the liveness check is performed at the process level rather than through Kubernetes' native HTTP health-checking mechanism, so this does not match the intended declarative configuration.

  • livenessProbe:\n httpGet:\n port: 8080

    Why it's wrong here

    This httpGet probe is missing the path field, so Kubernetes defaults the request path to "/" instead of "/healthz". The endpoint that actually handles liveness traffic would be whatever serves the root path, which may be a different application handler, a redirect, or a 404—any of which can cause false healthy or unhealthy results. To exercise the intended health endpoint, both path and port must be specified explicitly.

  • livenessProbe:\n httpGet:\n path: /healthz\n port: 8080

    Why this is correct

    This is the correct liveness probe because it declares an httpGet handler that instructs the kubelet to send an HTTP GET request to the container's /healthz endpoint on port 8080. Kubernetes considers the probe successful if the HTTP response status code is in the 200-399 range, so a 400 or 500 response would restart the container. This definition precisely matches the stated requirement of performing a HTTP GET liveness check against that path and port.

  • livenessProbe:\n tcpSocket:\n port: 8080

    Why it's wrong here

    This is a tcpSocket probe, which only verifies that a TCP connection can be established to port 8080; it does not perform an HTTP GET and therefore cannot validate that the /healthz path returns a healthy response. A service could accept TCP connections but still return HTTP 500 on the health endpoint, and this probe would incorrectly report health. Since the scenario explicitly requires an HTTP GET probe on a specific path, this option fails both the protocol and the path requirement.

About these practice questions

This CKAD question is part of Courseiva's 160-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This CKAD practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKAD exam.