Port-forward a service

Tunnel a cluster service port to localhost

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

tool
kubectl73 commands
tags
debugnetwork

More kubectl commands

  • 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

  • kubectl apply --server-side --dry-run=server -f file.yaml

    Validate manifest against live API without applying changes

all 73 kubectl commands