Kubernetes / Pods, Containers & Application Health
Select the right container when reading a multi-container Pod's logs
A Pod can include an application, proxy and initialization components with different failure modes. An unlabeled log excerpt can point to the wrong owner.
Environment and inputs: Kubernetes · kubectl with supported client/server versions and delegated RBAC. Examples use namespace app unless noted. Check context, namespace, APIs and provider support first.
Start with this check
Check which system and tools you are using. Replace example objects, namespaces, images, file paths and hosts with approved values. Remove sensitive information before sharing output. Follow the application owner’s process for changes.
kubectl -n app get pod web-0 -o jsonpath='{.spec.containers[*].name}'
kubectl -n app logs pod/web-0 -c web --tail=100
What the results mean
The first command lists regular container names; the second reads the explicit target. Init and ephemeral containers have separate fields.
Fix the cause and check again
Label evidence with Pod, namespace, container and collection time. Correlate the application's error with related components rather than assuming their outputs are interchangeable.
Before changing production
Do not publish complete logs without checking for tokens, personal data and internal endpoints.