kubectl port-forward to Kubernetes StatefulSet
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
orpo
(in this case the type “pod” may be omitted)deployment
ordeploy
service
orsvc
replicaset
orrs