KCNA · Question #127
If kubectl is failing to retrieve information from the cluster, where can you find pod logs to troubleshoot?
The correct answer is A. /var/log/pods/. Pod logs are written directly to /var/log/pods/ on the node's filesystem, making this the go-to location when kubectl logs is unavailable - each subdirectory is named by namespace, pod name, and UID, containing log files per container. Option B (~/.kube/config) is the…
Question
If kubectl is failing to retrieve information from the cluster, where can you find pod logs to troubleshoot?
Options
- A/var/log/pods/
- B~/.kube/config
- C/var/log/k8s/
- D/etc/kubernetes/
How the community answered
(37 responses)- A86% (32)
- B8% (3)
- C3% (1)
- D3% (1)
Explanation
Pod logs are written directly to /var/log/pods/ on the node's filesystem, making this the go-to location when kubectl logs is unavailable - each subdirectory is named by namespace, pod name, and UID, containing log files per container. Option B (~/.kube/config) is the kubeconfig file that stores cluster credentials and context, not logs. Option C (/var/log/k8s/) does not exist as a standard Kubernetes path. Option D (/etc/kubernetes/) holds cluster configuration and PKI certificates (used by control plane components), not runtime pod logs.
Memory tip: Think of /var/log/pods/ as the "bypass hatch" - when the Kubernetes API is down and kubectl can't reach the cluster, you drop down to the raw node filesystem where the container runtime (containerd/Docker) always writes logs regardless of API health.
Topics
Community Discussion
No community discussion yet for this question.