CKAD · Domain 3 of 5 · 15% of the exam

CKAD Domain 3: Application Observability and Maintenance

32 free practice questions for Application Observability and Maintenance in the Certified Kubernetes Application Developer (CKAD) exam. Try each question first, then open "Show answer" for the correct option and explanation.

Application Observability and Maintenance practice questions

  1. Question 1. Which probe handler runs a command inside the container and treats exit code 0 as success?

    1. httpGet
    2. exec
    3. tcpSocket
    4. grpc
    Show answer

    Answer: B. exec

    An exec probe passes when the command exits with 0. Keep it light, because it runs every periodSeconds.

  2. Question 2. An httpGet probe receives HTTP 302 from the app. How is it treated?

    1. As a failure, since only 200 passes
    2. As unknown, so the probe is retried
    3. As a success, since codes 200 to 399 pass
    4. As a success only if the redirect returns 200
    Show answer

    Answer: C. As a success, since codes 200 to 399 pass

    Any status code from 200 up to 399 counts as success for an HTTP probe.

  3. Question 3. A liveness probe has periodSeconds: 10 and failureThreshold: 3. Roughly how long must the app be unhealthy before the container restarts?

    1. About 10 seconds
    2. About 30 seconds
    3. About 3 seconds
    4. About 13 seconds
    Show answer

    Answer: B. About 30 seconds

    The kubelet needs 3 consecutive failures, one every 10 seconds, so about 30 seconds.

  4. Question 4. What is the default timeoutSeconds for a probe?

    1. 1 second
    2. 10 seconds
    3. 30 seconds
    4. No timeout
    Show answer

    Answer: A. 1 second

    A probe that takes longer than 1 second counts as failed. Slow health endpoints often need a higher timeoutSeconds.

  5. Question 5. A startup probe has periodSeconds: 10 and failureThreshold: 30. How long can the app take to start before it's restarted?

    1. Up to 30 seconds
    2. Up to 40 seconds
    3. Up to 300 seconds
    4. Up to 3,000 seconds
    Show answer

    Answer: C. Up to 300 seconds

    The window is failureThreshold × periodSeconds = 300 seconds. Liveness and readiness probes don't run until the startup probe succeeds.

  6. Question 6. For which probes must successThreshold be 1?

    1. Readiness probes only
    2. All three probe types
    3. None; any value is allowed
    4. Liveness and startup probes
    Show answer

    Answer: D. Liveness and startup probes

    Readiness probes can require several successes in a row; liveness and startup probes must use 1.

  7. Question 7. Which probe should check that the app's dependencies, such as its database, are reachable before it receives traffic?

    1. Liveness
    2. Startup
    3. Readiness
    4. A preStop hook
    Show answer

    Answer: C. Readiness

    A failing readiness probe removes the Pod from Service endpoints without restarting it. Checking dependencies in a liveness probe can restart every replica when the database blips.

  8. Question 8. Which probe handler only checks that a port accepts a TCP connection?

    1. exec
    2. httpGet
    3. grpc
    4. tcpSocket
    Show answer

    Answer: D. tcpSocket

    tcpSocket passes if a connection to the port succeeds. It doesn't check what the app sends back.

  9. Question 9. Which command shows the logs from the previous instance of a container that crashed?

    1. kubectl logs web --previous
    2. kubectl logs web --since=crash
    3. kubectl describe pod web --logs
    4. kubectl logs web --restart=1
    Show answer

    Answer: A. kubectl logs web --previous

    --previous (-p) reads the terminated container's logs, which usually explain a CrashLoopBackOff.

  10. Question 10. Which command prints logs from all Pods with the label app=web?

    1. kubectl get logs app=web
    2. kubectl logs -l app=web
    3. kubectl logs deployment --all app=web
    4. kubectl logs --selector-all web
    Show answer

    Answer: B. kubectl logs -l app=web

    -l takes a label selector. Add --prefix to see which Pod each line came from.

  11. Question 11. Which command shows only the last 50 log lines from Pod web?

    1. kubectl logs web --head=50
    2. kubectl logs web --limit=50
    3. kubectl logs web --tail=50
    4. kubectl logs web -n 50
    Show answer

    Answer: C. kubectl logs web --tail=50

    --tail limits the number of lines. -n is the namespace flag, not a line count.

  12. Question 12. Which command shows the logs that Pod web wrote in the last hour?

    1. kubectl logs web --since=1h
    2. kubectl logs web --from=-1h
    3. kubectl logs web --age=1h
    4. kubectl logs web --tail=1h
    Show answer

    Answer: A. kubectl logs web --since=1h

    --since takes a duration such as 10m or 1h; --since-time takes an RFC 3339 timestamp.

  13. Question 13. Where should a containerized app write its logs so that kubectl logs shows them?

    1. To /var/log/app.log inside the container
    2. To stdout and stderr
    3. To a ConfigMap named after the Pod
    4. To the node's syslog socket
    Show answer

    Answer: B. To stdout and stderr

    The container runtime captures stdout and stderr. Logs written to files in the container need a sidecar to be collected.

  14. Question 14. Which command lists Pods sorted by memory use?

    1. kubectl get pods --sort-by=memory
    2. kubectl describe pods --sort=memory
    3. kubectl top node --pods --memory
    4. kubectl top pod --sort-by=memory
    Show answer

    Answer: D. kubectl top pod --sort-by=memory

    kubectl top reads from the Metrics API (metrics-server) and can sort by cpu or memory.

  15. Question 15. Which command shows CPU and memory use for each container within the Pods?

    1. kubectl top pod --containers
    2. kubectl describe pod --usage
    3. kubectl get pods -o metrics
    4. kubectl logs --stats
    Show answer

    Answer: A. kubectl top pod --containers

    --containers breaks a Pod's usage down per container.

  16. Question 16. Which command lists only the events for Pod web?

    1. kubectl get events --selector=pod-name=web
    2. kubectl logs web --events --all-containers
    3. kubectl get events --field-selector involvedObject.name=web
    4. kubectl get pod web --show-events=true
    Show answer

    Answer: C. kubectl get events --field-selector involvedObject.name=web

    Events aren't labeled with the Pod's labels; filter on involvedObject fields. kubectl describe pod also shows them.

  17. Question 17. Which command adds an ephemeral debug container to running Pod web that can see the processes of container app?

    1. kubectl exec -it web --image=busybox -c app
    2. kubectl debug -it web --image=busybox --target=app
    3. kubectl attach web --image=busybox --target=app
    4. kubectl run debug --pod=web --image=busybox
    Show answer

    Answer: B. kubectl debug -it web --image=busybox --target=app

    Ephemeral containers join a running Pod. --target shares the target container's process namespace, so tools like ps work.

  18. Question 18. Which command makes a copy of Pod web with an extra debugging container, leaving the original Pod untouched?

    1. kubectl cp web web-debug --image=busybox
    2. kubectl run web-debug --from=pod/web
    3. kubectl debug web --clone --image=busybox
    4. kubectl debug web -it --image=busybox --copy-to=web-debug
    Show answer

    Answer: D. kubectl debug web -it --image=busybox --copy-to=web-debug

    --copy-to creates a new Pod from the original's spec. Add --share-processes to see the other containers' processes.

  19. Question 19. Which command watches Pods and prints changes as they happen?

    1. kubectl get pods -w
    2. kubectl get pods --follow
    3. kubectl logs pods -w
    4. kubectl describe pods --live
    Show answer

    Answer: A. kubectl get pods -w

    --watch (-w) keeps the request open and prints a line for each change.

  20. Question 20. Which command copies /tmp/dump.txt out of Pod web to the local machine?

    1. kubectl exec web -- cp /tmp/dump.txt .
    2. kubectl cp web:/tmp/dump.txt ./dump.txt
    3. kubectl logs web --file=/tmp/dump.txt
    4. kubectl get pod web --copy /tmp/dump.txt
    Show answer

    Answer: B. kubectl cp web:/tmp/dump.txt ./dump.txt

    kubectl cp uses tar in the container, so the image must include tar.

  21. Question 21. Where can a container write a short reason for exiting so that it appears in kubectl describe?

    1. /var/log/exit.log
    2. /proc/1/status
    3. /dev/termination-log
    4. /etc/kubernetes/exit
    Show answer

    Answer: C. /dev/termination-log

    This is the default terminationMessagePath. Set terminationMessagePolicy: FallbackToLogsOnError to use the log tail if the file is empty.

  22. Question 22. A container's restart count keeps rising, but kubectl logs shows nothing useful. What should you check next?

    1. The node's kube-proxy logs
    2. The Deployment's revision history
    3. The Service's EndpointSlices
    4. Last State and Events in kubectl describe pod
    Show answer

    Answer: D. Last State and Events in kubectl describe pod

    describe shows the exit code and reason of the last termination (such as OOMKilled or Error) and events such as failing probes.

  23. Question 23. After a cluster upgrade, applying a manifest fails with "no matches for kind Deployment in version extensions/v1beta1". What is wrong?

    1. The manifest uses an API version that was removed
    2. The Deployment controller isn't running
    3. The namespace in the manifest doesn't exist
    4. The user lacks RBAC rights to create Deployments
    Show answer

    Answer: A. The manifest uses an API version that was removed

    Deployments moved to apps/v1, and old beta versions were removed. Update apiVersion and any fields that changed.

  24. Question 24. Which command lists the API versions the cluster currently serves?

    1. kubectl version --apis
    2. kubectl api-versions
    3. kubectl cluster-info --apis
    4. kubectl explain --versions
    Show answer

    Answer: B. kubectl api-versions

    kubectl api-versions prints group/version pairs. kubectl api-resources shows each resource and its preferred version.

  25. Question 25. Which kubectl plugin rewrites manifests from a deprecated API version to a newer one?

    1. kubectl migrate
    2. kubectl upgrade
    3. kubectl rewrite
    4. kubectl convert
    Show answer

    Answer: D. kubectl convert

    kubectl convert is installed separately as a plugin. For example: kubectl convert -f old.yaml --output-version apps/v1.

  26. Question 26. Under the Kubernetes deprecation policy, how long must a deprecated beta API version still be served?

    1. 9 months or 3 releases, whichever is longer
    2. 1 release, then it is removed
    3. 12 months or 4 releases, whichever is shorter
    4. Forever, within the same major version
    Show answer

    Answer: A. 9 months or 3 releases, whichever is longer

    Deprecated beta APIs get at least 9 months or 3 releases. GA versions can be deprecated but not removed within a major version.

  27. Question 27. How does kubectl show that a request used a deprecated API version?

    1. It refuses the request until --force is set
    2. It logs the request to the kubelet journal
    3. It prints a warning returned by the API server
    4. It silently converts the manifest file
    Show answer

    Answer: C. It prints a warning returned by the API server

    The API server returns a Warning header, which kubectl prints. The apiserver_requested_deprecated_apis metric tracks this as well.

  28. Question 28. Which command blocks until Pod web is Ready, giving up after 60 seconds?

    1. kubectl get pod web --until=Ready
    2. kubectl wait --for=condition=Ready pod/web --timeout=60s
    3. kubectl rollout status pod/web --timeout=60s
    4. kubectl describe pod web --wait=60
    Show answer

    Answer: B. kubectl wait --for=condition=Ready pod/web --timeout=60s

    kubectl wait exits 0 when the condition is met and non-zero on timeout. rollout status doesn't work on bare Pods.

  29. Question 29. Which command documents the fields of a container's livenessProbe?

    1. kubectl describe pod --field=livenessProbe
    2. kubectl get pod -o explain
    3. kubectl help probes
    4. kubectl explain pod.spec.containers.livenessProbe
    Show answer

    Answer: D. kubectl explain pod.spec.containers.livenessProbe

    kubectl explain walks the schema with dotted paths; --recursive prints every nested field.

  30. Question 30. A Pod shows CreateContainerConfigError. What is a common cause?

    1. A referenced ConfigMap or Secret key doesn't exist
    2. The image tag can't be found in the registry
    3. The node has run out of memory
    4. The readiness probe keeps timing out
    Show answer

    Answer: A. A referenced ConfigMap or Secret key doesn't exist

    The kubelet can't build the container config, for example when an env var references a missing key. Missing images show ErrImagePull instead.

  31. Question 31. Which probe setting delays the first check after the container starts?

    1. periodSeconds
    2. timeoutSeconds
    3. initialDelaySeconds
    4. terminationGracePeriodSeconds
    Show answer

    Answer: C. initialDelaySeconds

    initialDelaySeconds waits before the first probe. For slow starts, a startup probe is usually the better tool.

  32. Question 32. Which command forwards local port 9090 to port 8080 of Pod web for debugging?

    1. kubectl port-forward pod/web 8080:9090
    2. kubectl port-forward pod/web 9090:8080
    3. kubectl expose pod web --port=9090:8080
    4. kubectl proxy pod/web 9090:8080
    Show answer

    Answer: B. kubectl port-forward pod/web 9090:8080

    The format is LOCAL:REMOTE. kubectl proxy forwards to the API server, not to Pods.

CKAD, Certified Kubernetes Application Developer, and Kubernetes are trademarks of The Linux Foundation. These questions are original study material, not questions from the real exam.