1KUBERNETES(1) Jan 2015 KUBERNETES(1)
2
3
4
6 kubectl get - Display one or many resources
7
8
9
11 kubectl get [OPTIONS]
12
13
14
16 Display one or many resources
17
18
19 Prints a table of the most important information about the specified
20 resources. You can filter the list using a label selector and the
21 --selector flag. If the desired resource type is namespaced you will
22 only see results in your current namespace unless you pass --all-names‐
23 paces.
24
25
26 Uninitialized objects are not shown unless --include-uninitialized is
27 passed.
28
29
30 By specifying the output as 'template' and providing a Go template as
31 the value of the --template flag, you can filter the attributes of the
32 fetched resources.
33
34
35 Use "kubectl api-resources" for a complete list of supported resources.
36
37
38
40 --all-namespaces=false
41 If present, list the requested object(s) across all namespaces.
42 Namespace in current context is ignored even if specified with --names‐
43 pace.
44
45
46 --allow-missing-template-keys=true
47 If true, ignore any errors in templates when a field or map key is
48 missing in the template. Only applies to golang and jsonpath output
49 formats.
50
51
52 --chunk-size=500
53 Return large lists in chunks rather than all at once. Pass 0 to
54 disable. This flag is beta and may change in the future.
55
56
57 --export=false
58 If true, use 'export' for the resources. Exported resources are
59 stripped of cluster-specific information.
60
61
62 --field-selector=""
63 Selector (field query) to filter on, supports '=', '==', and
64 '!='.(e.g. --field-selector key1=value1,key2=value2). The server only
65 supports a limited number of field queries per type.
66
67
68 -f, --filename=[]
69 Filename, directory, or URL to files identifying the resource to
70 get from a server.
71
72
73 --ignore-not-found=false
74 If the requested object does not exist the command will return exit
75 code 0.
76
77
78 --include-uninitialized=false
79 If true, the kubectl command applies to uninitialized objects. If
80 explicitly set to false, this flag overrides other flags that make the
81 kubectl commands apply to uninitialized objects, e.g., "--all". Objects
82 with empty metadata.initializers are regarded as initialized.
83
84
85 -L, --label-columns=[]
86 Accepts a comma separated list of labels that are going to be pre‐
87 sented as columns. Names are case-sensitive. You can also use multiple
88 flag options like -L label1 -L label2...
89
90
91 --no-headers=false
92 When using the default or custom-column output format, don't print
93 headers (default print headers).
94
95
96 -o, --output=""
97 Output format. One of: json|yaml|wide|name|custom-columns=...|cus‐
98 tom-columns-file=...|go-template=...|go-template-file=...|json‐
99 path=...|jsonpath-file=... See custom columns [ ⟨http://kuber‐
100 netes.io/docs/user-guide/kubectl-overview/#custom-columns⟩], golang
101 template [ ⟨http://golang.org/pkg/text/template/#pkg-overview⟩] and
102 jsonpath template [ ⟨http://kubernetes.io/docs/user-guide/jsonpath⟩].
103
104
105 --raw=""
106 Raw URI to request from the server. Uses the transport specified
107 by the kubeconfig file.
108
109
110 -R, --recursive=false
111 Process the directory used in -f, --filename recursively. Useful
112 when you want to manage related manifests organized within the same
113 directory.
114
115
116 -l, --selector=""
117 Selector (label query) to filter on, supports '=', '==', and
118 '!='.(e.g. -l key1=value1,key2=value2)
119
120
121 --server-print=true
122 If true, have the server return the appropriate table output. Sup‐
123 ports extension APIs and CRDs.
124
125
126 -a, --show-all=true
127 When printing, show all resources (default show all pods including
128 terminated one.)
129
130
131 --show-kind=false
132 If present, list the resource type for the requested object(s).
133
134
135 --show-labels=false
136 When printing, show all labels as the last column (default hide
137 labels column)
138
139
140 --sort-by=""
141 If non-empty, sort list types using this field specification. The
142 field specification is expressed as a JSONPath expression (e.g.
143 '{.metadata.name}'). The field in the API resource specified by this
144 JSONPath expression must be an integer or a string.
145
146
147 --template=""
148 Template string or path to template file to use when -o=go-tem‐
149 plate, -o=go-template-file. The template format is golang templates [
150 ⟨http://golang.org/pkg/text/template/#pkg-overview⟩].
151
152
153 --use-openapi-print-columns=false
154 If true, use x-kubernetes-print-column metadata (if present) from
155 the OpenAPI schema for displaying a resource.
156
157
158 -w, --watch=false
159 After listing/getting the requested object, watch for changes.
160 Uninitialized objects are excluded if no object name is provided.
161
162
163 --watch-only=false
164 Watch for changes to the requested object(s), without listing/get‐
165 ting first.
166
167
168
170 --alsologtostderr=false
171 log to standard error as well as files
172
173
174 --application-metrics-count-limit=100
175 Max number of application metrics to store (per container)
176
177
178 --as=""
179 Username to impersonate for the operation
180
181
182 --as-group=[]
183 Group to impersonate for the operation, this flag can be repeated
184 to specify multiple groups.
185
186
187 --azure-container-registry-config=""
188 Path to the file containing Azure container registry configuration
189 information.
190
191
192 --boot-id-file="/proc/sys/kernel/random/boot_id"
193 Comma-separated list of files to check for boot-id. Use the first
194 one that exists.
195
196
197 --cache-dir="/builddir/.kube/http-cache"
198 Default HTTP cache directory
199
200
201 --certificate-authority=""
202 Path to a cert file for the certificate authority
203
204
205 --client-certificate=""
206 Path to a client certificate file for TLS
207
208
209 --client-key=""
210 Path to a client key file for TLS
211
212
213 --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
214 CIDRs opened in GCE firewall for LB traffic proxy health checks
215
216
217 --cluster=""
218 The name of the kubeconfig cluster to use
219
220
221 --container-hints="/etc/cadvisor/container_hints.json"
222 location of the container hints file
223
224
225 --containerd="unix:///var/run/containerd.sock"
226 containerd endpoint
227
228
229 --context=""
230 The name of the kubeconfig context to use
231
232
233 --default-not-ready-toleration-seconds=300
234 Indicates the tolerationSeconds of the toleration for
235 notReady:NoExecute that is added by default to every pod that does not
236 already have such a toleration.
237
238
239 --default-unreachable-toleration-seconds=300
240 Indicates the tolerationSeconds of the toleration for unreach‐
241 able:NoExecute that is added by default to every pod that does not
242 already have such a toleration.
243
244
245 --docker="unix:///var/run/docker.sock"
246 docker endpoint
247
248
249 --docker-env-metadata-whitelist=""
250 a comma-separated list of environment variable keys that needs to
251 be collected for docker containers
252
253
254 --docker-only=false
255 Only report docker containers in addition to root stats
256
257
258 --docker-root="/var/lib/docker"
259 DEPRECATED: docker root is read from docker info (this is a fall‐
260 back, default: /var/lib/docker)
261
262
263 --docker-tls=false
264 use TLS to connect to docker
265
266
267 --docker-tls-ca="ca.pem"
268 path to trusted CA
269
270
271 --docker-tls-cert="cert.pem"
272 path to client certificate
273
274
275 --docker-tls-key="key.pem"
276 path to private key
277
278
279 --enable-load-reader=false
280 Whether to enable cpu load reader
281
282
283 --event-storage-age-limit="default=0"
284 Max length of time for which to store events (per type). Value is a
285 comma separated list of key values, where the keys are event types
286 (e.g.: creation, oom) or "default" and the value is a duration. Default
287 is applied to all non-specified event types
288
289
290 --event-storage-event-limit="default=0"
291 Max number of events to store (per type). Value is a comma sepa‐
292 rated list of key values, where the keys are event types (e.g.: cre‐
293 ation, oom) or "default" and the value is an integer. Default is
294 applied to all non-specified event types
295
296
297 --global-housekeeping-interval=1m0s
298 Interval between global housekeepings
299
300
301 --housekeeping-interval=10s
302 Interval between container housekeepings
303
304
305 --insecure-skip-tls-verify=false
306 If true, the server's certificate will not be checked for validity.
307 This will make your HTTPS connections insecure
308
309
310 --kubeconfig=""
311 Path to the kubeconfig file to use for CLI requests.
312
313
314 --log-backtrace-at=:0
315 when logging hits line file:N, emit a stack trace
316
317
318 --log-cadvisor-usage=false
319 Whether to log the usage of the cAdvisor container
320
321
322 --log-dir=""
323 If non-empty, write log files in this directory
324
325
326 --log-file=""
327 If non-empty, use this log file
328
329
330 --log-flush-frequency=5s
331 Maximum number of seconds between log flushes
332
333
334 --logtostderr=true
335 log to standard error instead of files
336
337
338 --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
339 Comma-separated list of files to check for machine-id. Use the
340 first one that exists.
341
342
343 --match-server-version=false
344 Require server version to match client version
345
346
347 --mesos-agent="127.0.0.1:5051"
348 Mesos agent address
349
350
351 --mesos-agent-timeout=10s
352 Mesos agent timeout
353
354
355 -n, --namespace=""
356 If present, the namespace scope for this CLI request
357
358
359 --password=""
360 Password for basic authentication to the API server
361
362
363 --profile="none"
364 Name of profile to capture. One of (none|cpu|heap|goroutine|thread‐
365 create|block|mutex)
366
367
368 --profile-output="profile.pprof"
369 Name of the file to write the profile to
370
371
372 --request-timeout="0"
373 The length of time to wait before giving up on a single server
374 request. Non-zero values should contain a corresponding time unit (e.g.
375 1s, 2m, 3h). A value of zero means don't timeout requests.
376
377
378 -s, --server=""
379 The address and port of the Kubernetes API server
380
381
382 --skip-headers=false
383 If true, avoid header prefixes in the log messages
384
385
386 --stderrthreshold=2
387 logs at or above this threshold go to stderr
388
389
390 --storage-driver-buffer-duration=1m0s
391 Writes in the storage driver will be buffered for this duration,
392 and committed to the non memory backends as a single transaction
393
394
395 --storage-driver-db="cadvisor"
396 database name
397
398
399 --storage-driver-host="localhost:8086"
400 database host:port
401
402
403 --storage-driver-password="root"
404 database password
405
406
407 --storage-driver-secure=false
408 use secure connection with database
409
410
411 --storage-driver-table="stats"
412 table name
413
414
415 --storage-driver-user="root"
416 database username
417
418
419 --token=""
420 Bearer token for authentication to the API server
421
422
423 --user=""
424 The name of the kubeconfig user to use
425
426
427 --username=""
428 Username for basic authentication to the API server
429
430
431 -v, --v=0
432 log level for V logs
433
434
435 --version=false
436 Print version information and quit
437
438
439 --vmodule=
440 comma-separated list of pattern=N settings for file-filtered log‐
441 ging
442
443
444
446 # List all pods in ps output format.
447 kubectl get pods
448
449 # List all pods in ps output format with more information (such as node name).
450 kubectl get pods -o wide
451
452 # List a single replication controller with specified NAME in ps output format.
453 kubectl get replicationcontroller web
454
455 # List deployments in JSON output format, in the "v1" version of the "apps" API group:
456 kubectl get deployments.v1.apps -o json
457
458 # List a single pod in JSON output format.
459 kubectl get -o json pod web-pod-13je7
460
461 # List a pod identified by type and name specified in "pod.yaml" in JSON output format.
462 kubectl get -f pod.yaml -o json
463
464 # Return only the phase value of the specified pod.
465 kubectl get -o template pod/web-pod-13je7 --template={{.status.phase}}
466
467 # List all replication controllers and services together in ps output format.
468 kubectl get rc,services
469
470 # List one or more resources by their type and names.
471 kubectl get rc/web service/frontend pods/web-pod-13je7
472
473
474
475
477 kubectl(1),
478
479
480
482 January 2015, Originally compiled by Eric Paris (eparis at redhat dot
483 com) based on the kubernetes source material, but hopefully they have
484 been automatically generated since!
485
486
487
488Eric Paris kubernetes User Manuals KUBERNETES(1)