CKAD Observability: Probes, Logging, and Debugging 1 — Questions and Answers
Question 1: What does a Liveness Probe do when it fails?
- Removes the pod from Service endpoints
- Restarts the container (Correct answer)
- Evicts the pod from the node
- Sends an alert to the cluster admin
Correct answer: Restarts the container
A failing liveness probe causes Kubernetes to kill and restart the container according to the pod's restartPolicy.
Question 2: What is the purpose of a Readiness Probe?
- To restart a container that is stuck
- To determine if a container is ready to receive traffic (Correct answer)
- To initialize a container before app code runs
- To check if the node has sufficient resources
Correct answer: To determine if a container is ready to receive traffic
Readiness probes tell Kubernetes when a container is ready to serve requests; failing pods are removed from Service endpoints.
Question 3: Which liveness probe type sends an HTTP GET request to a specified path and port?
- exec
- tcpSocket
- httpGet (Correct answer)
- grpc
Correct answer: httpGet
The 'httpGet' probe type sends an HTTP GET request; a 2xx or 3xx status is considered success.
Question 4: What does the 'initialDelaySeconds' field in a probe configuration specify?
- How long to wait between probe attempts
- How long to wait after the container starts before the first probe is run (Correct answer)
- How long a probe can run before timing out
- How many seconds before the probe is considered failed
Correct answer: How long to wait after the container starts before the first probe is run
'initialDelaySeconds' delays the first probe execution, giving the container time to start up before health checks begin.
Question 5: Which command streams live logs from a pod named 'web-pod'?
- kubectl logs web-pod --live
- kubectl logs web-pod -f (Correct answer)
- kubectl tail web-pod
- kubectl watch logs web-pod
Correct answer: kubectl logs web-pod -f
The '-f' flag (follow) streams logs in real time, similar to 'tail -f' on a log file.
Question 6: A Startup Probe is used for containers with slow startup times. What happens while the Startup Probe has not yet succeeded?
- Liveness and Readiness Probes run normally
- Liveness and Readiness Probes are disabled until the Startup Probe succeeds (Correct answer)
- The container is killed after 30 seconds
- The pod status shows 'Pending'
Correct answer: Liveness and Readiness Probes are disabled until the Startup Probe succeeds
While the Startup Probe is active, liveness and readiness probes are paused, preventing premature restarts during slow startup.
What does a Liveness Probe do when it fails?