Exec into pod

Interactive shell inside a running container

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

tool
kubectl73 commands
tags
podsdebug

More kubectl commands

  • 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

  • kubectl scale deployment/<name> --replicas=3 -n <ns>

    Immediately change replica count

  • kubectl get events -A --sort-by='.lastTimestamp'

    Recent cluster events, oldest first — great for post-incident review

all 73 kubectl commands