kubectl-logs
Show logs for containers in a pod. tldr-pages
On several platforms
Several platforms
Show logs for a single-container pod
kubectl logs pod_nameIdentifyShow logs for a specified container in a pod
kubectl logs --container container_name pod_nameIdentify--containerPrint the logs of this container kubectl referenceShow logs for all containers in a pod
kubectl logs --all-containers=true pod_nameIdentify--all-containersGet all containers' logs in the pod(s). kubectl referenceStream pod logs
kubectl logs --follow pod_nameIdentify--followSpecify if the logs should be streamed. kubectl referenceShow pod logs newer than a relative time like 10s, 5m, or 1h
kubectl logs --since relative_time pod_nameIdentify--sinceOnly return logs newer than a relative duration like 5s, 2m, or 3h. kubectl referenceShow the 10 most recent logs in a pod
kubectl logs --tail 10 pod_nameIdentify--tailLines of recent log file to display. kubectl referenceShow all pod logs for a given deployment
kubectl logs [deploy/deployment_nameIdentify