1KUBERNETES(1)                      Jan 2015                      KUBERNETES(1)
2
3
4

NAME

6       kubectl port-forward - Forward one or more local ports to a pod
7
8
9

SYNOPSIS

11       kubectl port-forward [OPTIONS]
12
13
14

DESCRIPTION

16       Forward one or more local ports to a pod.
17
18
19       Use resource type/name such as deployment/mydeployment to select a pod.
20       Resource type defaults to 'pod' if omitted.
21
22
23       If there are multiple  pods  matching  the  criteria,  a  pod  will  be
24       selected  automatically.  The forwarding session ends when the selected
25       pod terminates, and rerun of the command is needed to  resume  forward‐
26       ing.
27
28
29

OPTIONS

31       --pod-running-timeout=1m0s
32           The  length  of time (like 5s, 2m, or 3h, higher than zero) to wait
33       until at least one pod is running
34
35
36

OPTIONS INHERITED FROM PARENT COMMANDS

38       --allow-verification-with-non-compliant-keys=false
39           Allow  a  SignatureVerifier  to  use  keys  which  are  technically
40       non-compliant with RFC6962.
41
42
43       --alsologtostderr=false
44           log to standard error as well as files
45
46
47       --application-metrics-count-limit=100
48           Max number of application metrics to store (per container)
49
50
51       --as=""
52           Username to impersonate for the operation
53
54
55       --as-group=[]
56           Group  to  impersonate for the operation, this flag can be repeated
57       to specify multiple groups.
58
59
60       --azure-container-registry-config=""
61           Path to the file containing Azure container registry  configuration
62       information.
63
64
65       --boot-id-file="/proc/sys/kernel/random/boot_id"
66           Comma-separated  list  of files to check for boot-id. Use the first
67       one that exists.
68
69
70       --cache-dir="/builddir/.kube/http-cache"
71           Default HTTP cache directory
72
73
74       --certificate-authority=""
75           Path to a cert file for the certificate authority
76
77
78       --client-certificate=""
79           Path to a client certificate file for TLS
80
81
82       --client-key=""
83           Path to a client key file for TLS
84
85
86       --cloud-provider-gce-lb-src-cidrs=130.211.0.0/22,209.85.152.0/22,209.85.204.0/22,35.191.0.0/16
87           CIDRs opened in GCE firewall for LB traffic proxy  health checks
88
89
90       --cluster=""
91           The name of the kubeconfig cluster to use
92
93
94       --container-hints="/etc/cadvisor/container_hints.json"
95           location of the container hints file
96
97
98       --containerd="unix:///var/run/containerd.sock"
99           containerd endpoint
100
101
102       --context=""
103           The name of the kubeconfig context to use
104
105
106       --default-not-ready-toleration-seconds=300
107           Indicates    the    tolerationSeconds   of   the   toleration   for
108       notReady:NoExecute that is added by default to every pod that does  not
109       already have such a toleration.
110
111
112       --default-unreachable-toleration-seconds=300
113           Indicates  the  tolerationSeconds  of  the  toleration for unreach‐
114       able:NoExecute that is added by default to  every  pod  that  does  not
115       already have such a toleration.
116
117
118       --docker="unix:///var/run/docker.sock"
119           docker endpoint
120
121
122       --docker-env-metadata-whitelist=""
123           a  comma-separated  list of environment variable keys that needs to
124       be collected for docker containers
125
126
127       --docker-only=false
128           Only report docker containers in addition to root stats
129
130
131       --docker-root="/var/lib/docker"
132           DEPRECATED: docker root is read from docker info (this is  a  fall‐
133       back, default: /var/lib/docker)
134
135
136       --docker-tls=false
137           use TLS to connect to docker
138
139
140       --docker-tls-ca="ca.pem"
141           path to trusted CA
142
143
144       --docker-tls-cert="cert.pem"
145           path to client certificate
146
147
148       --docker-tls-key="key.pem"
149           path to private key
150
151
152       --enable-load-reader=false
153           Whether to enable cpu load reader
154
155
156       --event-storage-age-limit="default=0"
157           Max length of time for which to store events (per type). Value is a
158       comma separated list of key values, where  the  keys  are  event  types
159       (e.g.: creation, oom) or "default" and the value is a duration. Default
160       is applied to all non-specified event types
161
162
163       --event-storage-event-limit="default=0"
164           Max number of events to store (per type). Value is  a  comma  sepa‐
165       rated  list  of  key values, where the keys are event types (e.g.: cre‐
166       ation, oom) or "default" and  the  value  is  an  integer.  Default  is
167       applied to all non-specified event types
168
169
170       --global-housekeeping-interval=1m0s
171           Interval between global housekeepings
172
173
174       --google-json-key=""
175           The  Google  Cloud  Platform  Service  Account  JSON Key to use for
176       authentication.
177
178
179       --housekeeping-interval=10s
180           Interval between container housekeepings
181
182
183       --insecure-skip-tls-verify=false
184           If true, the server's certificate will not be checked for validity.
185       This will make your HTTPS connections insecure
186
187
188       --kubeconfig=""
189           Path to the kubeconfig file to use for CLI requests.
190
191
192       --log-backtrace-at=:0
193           when logging hits line file:N, emit a stack trace
194
195
196       --log-cadvisor-usage=false
197           Whether to log the usage of the cAdvisor container
198
199
200       --log-dir=""
201           If non-empty, write log files in this directory
202
203
204       --log-flush-frequency=5s
205           Maximum number of seconds between log flushes
206
207
208       --logtostderr=true
209           log to standard error instead of files
210
211
212       --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
213           Comma-separated  list  of  files  to  check for machine-id. Use the
214       first one that exists.
215
216
217       --match-server-version=false
218           Require server version to match client version
219
220
221       --mesos-agent="127.0.0.1:5051"
222           Mesos agent address
223
224
225       --mesos-agent-timeout=10s
226           Mesos agent timeout
227
228
229       -n, --namespace=""
230           If present, the namespace scope for this CLI request
231
232
233       --request-timeout="0"
234           The length of time to wait before giving  up  on  a  single  server
235       request. Non-zero values should contain a corresponding time unit (e.g.
236       1s, 2m, 3h). A value of zero means don't timeout requests.
237
238
239       -s, --server=""
240           The address and port of the Kubernetes API server
241
242
243       --stderrthreshold=2
244           logs at or above this threshold go to stderr
245
246
247       --storage-driver-buffer-duration=1m0s
248           Writes in the storage driver will be buffered  for  this  duration,
249       and committed to the non memory backends as a single transaction
250
251
252       --storage-driver-db="cadvisor"
253           database name
254
255
256       --storage-driver-host="localhost:8086"
257           database host:port
258
259
260       --storage-driver-password="root"
261           database password
262
263
264       --storage-driver-secure=false
265           use secure connection with database
266
267
268       --storage-driver-table="stats"
269           table name
270
271
272       --storage-driver-user="root"
273           database username
274
275
276       --token=""
277           Bearer token for authentication to the API server
278
279
280       --user=""
281           The name of the kubeconfig user to use
282
283
284       -v, --v=0
285           log level for V logs
286
287
288       --version=false
289           Print version information and quit
290
291
292       --vmodule=
293           comma-separated  list  of pattern=N settings for file-filtered log‐
294       ging
295
296
297

EXAMPLE

299                # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod
300                kubectl port-forward pod/mypod 5000 6000
301
302                # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the deployment
303                kubectl port-forward deployment/mydeployment 5000 6000
304
305                # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the service
306                kubectl port-forward service/myservice 5000 6000
307
308                # Listen on port 8888 locally, forwarding to 5000 in the pod
309                kubectl port-forward pod/mypod 8888:5000
310
311                # Listen on a random port locally, forwarding to 5000 in the pod
312                kubectl port-forward pod/mypod :5000
313
314
315
316

SEE ALSO

318       kubectl(1),
319
320
321

HISTORY

323       January 2015, Originally compiled by Eric Paris (eparis at  redhat  dot
324       com)  based  on the kubernetes source material, but hopefully they have
325       been automatically generated since!
326
327
328
329Eric Paris                  kubernetes User Manuals              KUBERNETES(1)
Impressum