Update the example for kubectl port-forward

Clarify that `REMOTE_PORT` is interpreted as identifying a _Service_ port when provided `TYPE` is `service`.
Also, highlight support for specifying a named port as `REMOTE_PORT`.

Kubernetes-commit: 68e8fd5f33647f22a1bd9ff8508003a969036e25
This commit is contained in:
Christopher Montoro 2020-10-07 21:37:03 -04:00 committed by Kubernetes Publisher
parent ade77d56eb
commit 74d55cc94b
2 changed files with 16 additions and 2 deletions

View File

@ -41,6 +41,20 @@ kubectl port-forward deployment/mydeployment 5000 6000
---
{% method %}
## Pod in a Service
Listen on port 8443 locally, forwarding to the targetPort of the service's port named "https" in a pod selected by the service
{% sample lang="yaml" %}
```bash
kubectl port-forward service/myservice 8443:https
```
{% endmethod %}
---
{% method %}
## Different Local and Remote Ports

View File

@ -76,8 +76,8 @@ var (
# Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the deployment
kubectl port-forward deployment/mydeployment 5000 6000
# Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the service
kubectl port-forward service/myservice 5000 6000
# Listen on port 8443 locally, forwarding to the targetPort of the service's port named "https" in a pod selected by the service
kubectl port-forward service/myservice 8443:https
# Listen on port 8888 locally, forwarding to 5000 in the pod
kubectl port-forward pod/mypod 8888:5000