1KUBERNETES(1) Jan 2015 KUBERNETES(1)
2
3
4
6 kubectl port-forward - Forward one or more local ports to a pod
7
8
9
11 kubectl port-forward [OPTIONS]
12
13
14
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
31 --address=[localhost]
32 Addresses to listen on (comma separated)
33
34
35 --pod-running-timeout=1m0s
36 The length of time (like 5s, 2m, or 3h, higher than zero) to wait
37 until at least one pod is running
38
39
40
42 --alsologtostderr=false
43 log to standard error as well as files
44
45
46 --application-metrics-count-limit=100
47 Max number of application metrics to store (per container)
48
49
50 --as=""
51 Username to impersonate for the operation
52
53
54 --as-group=[]
55 Group to impersonate for the operation, this flag can be repeated
56 to specify multiple groups.
57
58
59 --azure-container-registry-config=""
60 Path to the file containing Azure container registry configuration
61 information.
62
63
64 --boot-id-file="/proc/sys/kernel/random/boot_id"
65 Comma-separated list of files to check for boot-id. Use the first
66 one that exists.
67
68
69 --cache-dir="/builddir/.kube/http-cache"
70 Default HTTP cache directory
71
72
73 --certificate-authority=""
74 Path to a cert file for the certificate authority
75
76
77 --client-certificate=""
78 Path to a client certificate file for TLS
79
80
81 --client-key=""
82 Path to a client key file for TLS
83
84
85 --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
86 CIDRs opened in GCE firewall for LB traffic proxy health checks
87
88
89 --cluster=""
90 The name of the kubeconfig cluster to use
91
92
93 --container-hints="/etc/cadvisor/container_hints.json"
94 location of the container hints file
95
96
97 --containerd="unix:///var/run/containerd.sock"
98 containerd endpoint
99
100
101 --context=""
102 The name of the kubeconfig context to use
103
104
105 --default-not-ready-toleration-seconds=300
106 Indicates the tolerationSeconds of the toleration for
107 notReady:NoExecute that is added by default to every pod that does not
108 already have such a toleration.
109
110
111 --default-unreachable-toleration-seconds=300
112 Indicates the tolerationSeconds of the toleration for unreach‐
113 able:NoExecute that is added by default to every pod that does not
114 already have such a toleration.
115
116
117 --docker="unix:///var/run/docker.sock"
118 docker endpoint
119
120
121 --docker-env-metadata-whitelist=""
122 a comma-separated list of environment variable keys that needs to
123 be collected for docker containers
124
125
126 --docker-only=false
127 Only report docker containers in addition to root stats
128
129
130 --docker-root="/var/lib/docker"
131 DEPRECATED: docker root is read from docker info (this is a fall‐
132 back, default: /var/lib/docker)
133
134
135 --docker-tls=false
136 use TLS to connect to docker
137
138
139 --docker-tls-ca="ca.pem"
140 path to trusted CA
141
142
143 --docker-tls-cert="cert.pem"
144 path to client certificate
145
146
147 --docker-tls-key="key.pem"
148 path to private key
149
150
151 --enable-load-reader=false
152 Whether to enable cpu load reader
153
154
155 --event-storage-age-limit="default=0"
156 Max length of time for which to store events (per type). Value is a
157 comma separated list of key values, where the keys are event types
158 (e.g.: creation, oom) or "default" and the value is a duration. Default
159 is applied to all non-specified event types
160
161
162 --event-storage-event-limit="default=0"
163 Max number of events to store (per type). Value is a comma sepa‐
164 rated list of key values, where the keys are event types (e.g.: cre‐
165 ation, oom) or "default" and the value is an integer. Default is
166 applied to all non-specified event types
167
168
169 --global-housekeeping-interval=1m0s
170 Interval between global housekeepings
171
172
173 --housekeeping-interval=10s
174 Interval between container housekeepings
175
176
177 --insecure-skip-tls-verify=false
178 If true, the server's certificate will not be checked for validity.
179 This will make your HTTPS connections insecure
180
181
182 --kubeconfig=""
183 Path to the kubeconfig file to use for CLI requests.
184
185
186 --log-backtrace-at=:0
187 when logging hits line file:N, emit a stack trace
188
189
190 --log-cadvisor-usage=false
191 Whether to log the usage of the cAdvisor container
192
193
194 --log-dir=""
195 If non-empty, write log files in this directory
196
197
198 --log-file=""
199 If non-empty, use this log file
200
201
202 --log-flush-frequency=5s
203 Maximum number of seconds between log flushes
204
205
206 --logtostderr=true
207 log to standard error instead of files
208
209
210 --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
211 Comma-separated list of files to check for machine-id. Use the
212 first one that exists.
213
214
215 --match-server-version=false
216 Require server version to match client version
217
218
219 --mesos-agent="127.0.0.1:5051"
220 Mesos agent address
221
222
223 --mesos-agent-timeout=10s
224 Mesos agent timeout
225
226
227 -n, --namespace=""
228 If present, the namespace scope for this CLI request
229
230
231 --password=""
232 Password for basic authentication to the API server
233
234
235 --profile="none"
236 Name of profile to capture. One of (none|cpu|heap|goroutine|thread‐
237 create|block|mutex)
238
239
240 --profile-output="profile.pprof"
241 Name of the file to write the profile to
242
243
244 --request-timeout="0"
245 The length of time to wait before giving up on a single server
246 request. Non-zero values should contain a corresponding time unit (e.g.
247 1s, 2m, 3h). A value of zero means don't timeout requests.
248
249
250 -s, --server=""
251 The address and port of the Kubernetes API server
252
253
254 --skip-headers=false
255 If true, avoid header prefixes in the log messages
256
257
258 --stderrthreshold=2
259 logs at or above this threshold go to stderr
260
261
262 --storage-driver-buffer-duration=1m0s
263 Writes in the storage driver will be buffered for this duration,
264 and committed to the non memory backends as a single transaction
265
266
267 --storage-driver-db="cadvisor"
268 database name
269
270
271 --storage-driver-host="localhost:8086"
272 database host:port
273
274
275 --storage-driver-password="root"
276 database password
277
278
279 --storage-driver-secure=false
280 use secure connection with database
281
282
283 --storage-driver-table="stats"
284 table name
285
286
287 --storage-driver-user="root"
288 database username
289
290
291 --token=""
292 Bearer token for authentication to the API server
293
294
295 --user=""
296 The name of the kubeconfig user to use
297
298
299 --username=""
300 Username for basic authentication to the API server
301
302
303 -v, --v=0
304 log level for V logs
305
306
307 --version=false
308 Print version information and quit
309
310
311 --vmodule=
312 comma-separated list of pattern=N settings for file-filtered log‐
313 ging
314
315
316
318 # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod
319 kubectl port-forward pod/mypod 5000 6000
320
321 # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the deployment
322 kubectl port-forward deployment/mydeployment 5000 6000
323
324 # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the service
325 kubectl port-forward service/myservice 5000 6000
326
327 # Listen on port 8888 locally, forwarding to 5000 in the pod
328 kubectl port-forward pod/mypod 8888:5000
329
330 # Listen on port 8888 on all addresses, forwarding to 5000 in the pod
331 kubectl port-forward --address 0.0.0.0 pod/mypod 8888:5000
332
333 # Listen on port 8888 on localhost and selected IP, forwarding to 5000 in the pod
334 kubectl port-forward --address localhost,10.19.21.23 pod/mypod 8888:5000
335
336 # Listen on a random port locally, forwarding to 5000 in the pod
337 kubectl port-forward pod/mypod :5000
338
339
340
341
343 kubectl(1),
344
345
346
348 January 2015, Originally compiled by Eric Paris (eparis at redhat dot
349 com) based on the kubernetes source material, but hopefully they have
350 been automatically generated since!
351
352
353
354Eric Paris kubernetes User Manuals KUBERNETES(1)