CKAD Observability: Probes, Logging, and Debugging 2 — Questions and Answers
Question 1: Which probe type runs a command inside the container and considers exit code 0 as success?
- httpGet
- tcpSocket
- exec (Correct answer)
- grpc
Correct answer: exec
The 'exec' probe type runs a command in the container; exit code 0 means healthy, any other code means failure.
Question 2: What does 'kubectl describe pod mypod' show that 'kubectl get pod mypod' does not?
- Pod labels
- Detailed events, container states, probe results, and resource limits (Correct answer)
- Pod IP address
- Pod restart count
Correct answer: Detailed events, container states, probe results, and resource limits
'kubectl describe' provides detailed output including events, conditions, container state transitions, and probe configurations — essential for debugging.
Question 3: How do you run an interactive shell inside a running pod named 'debug-pod'?
- kubectl exec debug-pod -- /bin/sh
- kubectl exec -it debug-pod -- /bin/sh (Correct answer)
- kubectl shell debug-pod
- kubectl attach debug-pod -c shell
Correct answer: kubectl exec -it debug-pod -- /bin/sh
The '-it' flags allocate a TTY and keep stdin open, enabling an interactive shell session inside the container.
Question 4: A pod is in 'CrashLoopBackOff' status. What is the most likely cause?
- The pod has too many replicas
- The container keeps crashing after restart due to application errors or misconfigurations (Correct answer)
- The node is out of memory
- The pod's service is misconfigured
Correct answer: The container keeps crashing after restart due to application errors or misconfigurations
CrashLoopBackOff means the container starts, crashes, is restarted, and crashes again repeatedly — check logs to find the root cause.
Question 5: Which 'kubectl logs' flag shows logs from the previously terminated container instance?
- --last
- --previous (Correct answer)
- --history
- --terminated
Correct answer: --previous
'kubectl logs --previous' retrieves the logs of the last terminated container, useful for diagnosing crash causes.
Question 6: What probe field controls how many consecutive failures are required before a container is restarted?
- successThreshold
- failureThreshold (Correct answer)
- periodSeconds
- timeoutSeconds
Correct answer: failureThreshold
'failureThreshold' sets how many consecutive probe failures must occur before Kubernetes acts (restarts container for liveness, removes from service for readiness).
Which probe type runs a command inside the container and considers exit code 0 as success?