mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Merge pull request #95383 from montmanu/kubectl/port-forward
Update the example for kubectl port-forward
This commit is contained in:
commit
d236e50be7
@ -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 %}
|
{% method %}
|
||||||
## Different Local and Remote Ports
|
## Different Local and Remote Ports
|
||||||
|
|
||||||
|
@ -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
|
# 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
|
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
|
# 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 5000 6000
|
kubectl port-forward service/myservice 8443:https
|
||||||
|
|
||||||
# Listen on port 8888 locally, forwarding to 5000 in the pod
|
# Listen on port 8888 locally, forwarding to 5000 in the pod
|
||||||
kubectl port-forward pod/mypod 8888:5000
|
kubectl port-forward pod/mypod 8888:5000
|
||||||
|
Loading…
Reference in New Issue
Block a user