Skip to content

Commit c53cad7

Browse files
authored
Merge pull request kubernetes#126907 from alegueri/update-example-logs-all-pods
[UPDATE] updating logs examples to contain --all-pods flag
2 parents 352e33e + ab01874 commit c53cad7

File tree

1 file changed

+21
-0
lines changed
  • staging/src/k8s.io/kubectl/pkg/cmd/logs

1 file changed

+21
-0
lines changed

staging/src/k8s.io/kubectl/pkg/cmd/logs/logs.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,33 @@ var (
5757
# Return snapshot logs from pod nginx with only one container
5858
kubectl logs nginx
5959
60+
# Return snapshot logs from pod nginx, prefixing each line with the source pod and container name
61+
kubectl logs nginx --prefix
62+
63+
# Return snapshot logs from pod nginx, limiting output to 500 bytes
64+
kubectl logs nginx --limit-bytes=500
65+
66+
# Return snapshot logs from pod nginx, waiting up to 20 seconds for it to start running.
67+
kubectl logs nginx --pod-running-timeout=20s
68+
6069
# Return snapshot logs from pod nginx with multi containers
6170
kubectl logs nginx --all-containers=true
6271
72+
# Return snapshot logs from all pods in the deployment nginx
73+
kubectl logs deployment/nginx --all-pods=true
74+
6375
# Return snapshot logs from all containers in pods defined by label app=nginx
6476
kubectl logs -l app=nginx --all-containers=true
6577
78+
# Return snapshot logs from all pods defined by label app=nginx, limiting concurrent log requests to 10 pods
79+
kubectl logs -l app=nginx --max-log-requests=10
80+
6681
# Return snapshot of previous terminated ruby container logs from pod web-1
6782
kubectl logs -p -c ruby web-1
6883
84+
# Begin streaming the logs from pod nginx, continuing even if errors occur
85+
kubectl logs nginx -f --ignore-errors=true
86+
6987
# Begin streaming the logs of the ruby container in pod web-1
7088
kubectl logs -f -c ruby web-1
7189
@@ -77,6 +95,9 @@ var (
7795
7896
# Show all logs from pod nginx written in the last hour
7997
kubectl logs --since=1h nginx
98+
99+
# Show all logs with timestamps from pod nginx starting from August 30, 2024, at 06:00:00 UTC
100+
kubectl logs nginx --since-time=2024-08-30T06:00:00Z --timestamps=true
80101
81102
# Show logs from a kubelet with an expired serving certificate
82103
kubectl logs --insecure-skip-tls-verify-backend nginx

0 commit comments

Comments
 (0)