kubectl logs - continuously
kubectl logs <pod-id>
gets latest logs from my deployment - I am working on a bug and interested to know the logs at runtime - How can I get continuous stream of logs ?
edit: corrected question at the end.
kubectl logs -f <pod-id>
You can use the -f
flag:
-f, --follow=false: Specify if the logs should be streamed.
https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#logs
kubectl logs --help
will guide you:
Example:
# Begin streaming the logs of the ruby container in pod web-1
kubectl logs -f -c ruby web-1
Flags:
-f, --follow[=false]: Specify if the logs should be streamed.
You can also add --since=10m
or so start from that relative time ago.