Skip to content

CICD-151 · Collect bounded Pod logs ​

Encyclopedia · Kubernetes fundamentals · All snippets

Previous · CICD-150 · Next · CICD-152

1. Where it fits ​

  • Placement Bash run step following checkout, or equivalent lab terminal.
  • Prerequisites isolated Kubernetes namespace, kubectl and reviewed manifests.
  • Platforms kubernetes, local-lab.

2. Copy the snippet ​

bash
kubectl -n staging logs deploy/web --all-containers=true --tail=100 > web.log

3. How it works ​

The namespace and workload identify the log source. --tail limits output and the redirect saves the selected logs as diagnostic evidence.

4. Verify the result ​

Capture logs from the specific release and scrub sensitive fields.

Validation syntax-validated (Bash parse). Status definitions.