Merry Christmas & Happy 2027! Less downtime. More good times. Celebrating 13 years of sorlavit.com
Skip to content
Sorlavit KimIT Support, Network & Infrastructure Services Let’s talk

ปุ่มแปลไทยจะเปิดบทความผ่าน Google Translate เพื่อแปลอัตโนมัติ โดยคงโค้ดและคำสั่งไว้ตามต้นฉบับ

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.

Compiled for Sorlavit Kim · Published · Updated · 1 min read

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.

Share this article

Back to all articles