Follow pod logs

Stream logs in real time; add -c <container> for multi-container pods

kubectl logs -f <pod> -n <ns>

tool
kubectl73 commands
tags
logsdebug

More kubectl commands

  • kubectl logs <pod> --previous -n <ns>

    Logs from the last crashed/restarted container instance

  • kubectl exec -it <pod> -n <ns> -- bash

    Interactive shell inside a running container

  • kubectl port-forward svc/<name> 8080:80 -n <ns>

    Tunnel a cluster service port to localhost

  • kubectl rollout status deployment/<name> -n <ns>

    Block until rollout completes or times out (use in CI)

  • kubectl rollout undo deployment/<name> -n <ns>

    Revert to the previous revision

all 73 kubectl commands