0
0
Kubernetesdevops~5 mins

Debugging with kubectl debug in Kubernetes - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the kubectl debug command?
The kubectl debug command helps you create a temporary debugging container or pod to inspect and fix issues in your running Kubernetes pods without changing the original pod.
Click to reveal answer
beginner
How does kubectl debug differ from kubectl exec?
kubectl exec runs commands inside an existing container, while kubectl debug can create a new debugging container or pod with extra tools to help investigate problems.
Click to reveal answer
intermediate
How do you create an ephemeral container inside a running pod with kubectl debug?
Run kubectl debug <pod-name> --image=busybox --target=<container-name> without the --copy-to flag to add a temporary container inside a running pod for debugging.
Click to reveal answer
intermediate
Why are ephemeral containers useful for debugging?
Ephemeral containers let you add debugging tools to a running pod without restarting or changing it, so you can inspect the pod's state safely and quickly.
Click to reveal answer
beginner
What is a common use case for kubectl debug when a pod is stuck or not responding?
You can use kubectl debug to start a new pod with the same configuration or add an ephemeral container to inspect logs, network, or file system to find the cause of the problem.
Click to reveal answer
What does kubectl debug pod-name --image=busybox do?
ADeletes the pod and creates a new one
BAdds a temporary container inside a running pod for debugging
CExecutes a command inside the main container
DScales the pod to zero replicas
Which command helps you create a new pod for debugging based on an existing pod's configuration?
Akubectl debug pod-name --copy-to=new-pod
Bkubectl exec pod-name
Ckubectl delete pod-name
Dkubectl scale pod-name
Why might you prefer kubectl debug over restarting a pod to fix an issue?
AIt automatically fixes the bug
BIt deletes the pod faster
CIt scales the pod to multiple replicas
DIt allows inspection without stopping the pod
Which of these is NOT a feature of kubectl debug?
AAutomatically fixing pod errors
BCreating a copy pod for debugging
CRunning debugging tools inside pods
DAdding ephemeral containers
What is the first step to start debugging a pod with kubectl debug?
ARestart the Kubernetes cluster
BDelete the pod
CIdentify the pod name you want to debug
DScale the pod to zero
Explain how kubectl debug helps troubleshoot a stuck pod.
Think about how you can add tools or create a copy pod to look inside without stopping the original pod.
You got /4 concepts.
    Describe the difference between kubectl exec and kubectl debug.
    Consider what each command does inside or outside the pod.
    You got /4 concepts.