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
Confirm the environment and replace sample objects, namespaces, images, paths and hosts with approved targets. Share only relevant, sanitized output. Follow the workload 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
Read the result
The first command lists regular container names; the second reads the explicit target. Init and ephemeral containers have separate fields.
Resolve and verify
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.