1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/kubectl-logs.md
Arthur Lutz fc6e0fa71d
kubectl-logs: add logs for deployment (#12947)
* kubectl-logs: add logs for deployment

remove stream + container name which is a combination of two commands to keep list at recommended size

* kubectl-logs: syntax fix

---------

Co-authored-by: spageektti <git@spageektti.cc>
2024-06-12 16:08:44 +02:00

32 lines
790 B
Markdown

# kubectl logs
> Show logs for containers in a pod.
> More information: <https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#logs>.
- Show logs for a single-container pod:
`kubectl logs {{pod_name}}`
- Show logs for a specified container in a pod:
`kubectl logs --container {{container_name}} {{pod_name}}`
- Show logs for all containers in a pod:
`kubectl logs --all-containers={{true}} {{pod_name}}`
- Stream pod logs:
`kubectl logs --follow {{pod_name}}`
- Show pod logs newer than a relative time like `10s`, `5m`, or `1h`:
`kubectl logs --since={{relative_time}} {{pod_name}}`
- Show the 10 most recent logs in a pod:
`kubectl logs --tail={{10}} {{pod_name}}`
- Show all pod logs for a given deployment:
`kubectl logs deployment/{{deployment_name}}`