Merge pull request #95383 from montmanu/kubectl/port-forward

Update the example for kubectl port-forward
This commit is contained in:
Kubernetes Prow Robot 2020-10-08 06:56:16 -07:00 committed by GitHub
commit d236e50be7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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