kubectl port-forward to Kubernetes StatefulSet

Niel de Wet
1 min readJan 9, 2019

--

I could not find it documented anywhere, but it is possible to port-forward to a StatefulSet.

Usage:port-forward TYPE/NAME [options] [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N] 

To port-forward to a StatefulSet simply use statefulset as the TYPE :

kubectl port-forward statefulset/my-stateful-app 8080:8080

Other valid resource types here are:

  • pod or po (in this case the type “pod” may be omitted)
  • deployment or deploy
  • service or svc
  • replicaset or rs

--

--

No responses yet