File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
staging/src/k8s.io/kubectl
docs/book/pages/container_debugging Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,20 @@ kubectl port-forward deployment/mydeployment 5000 6000
41
41
42
42
---
43
43
44
+ {% method %}
45
+ ## Pod in a Service
46
+
47
+ Listen on port 8443 locally, forwarding to the targetPort of the service's port named "https" in a pod selected by the service
48
+ {% sample lang="yaml" %}
49
+
50
+ ``` bash
51
+ kubectl port-forward service/myservice 8443:https
52
+ ```
53
+
54
+ {% endmethod %}
55
+
56
+ ---
57
+
44
58
{% method %}
45
59
## Different Local and Remote Ports
46
60
Original file line number Diff line number Diff line change 76
76
# Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the deployment
77
77
kubectl port-forward deployment/mydeployment 5000 6000
78
78
79
- # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the service
80
- kubectl port-forward service/myservice 5000 6000
79
+ # Listen on port 8443 locally, forwarding to the targetPort of the service's port named "https" in a pod selected by the service
80
+ kubectl port-forward service/myservice 8443:https
81
81
82
82
# Listen on port 8888 locally, forwarding to 5000 in the pod
83
83
kubectl port-forward pod/mypod 8888:5000
You can’t perform that action at this time.
0 commit comments