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

NAME

6       kubectl get - Display one or many resources
7
8
9

SYNOPSIS

11       kubectl get [OPTIONS]
12
13
14

DESCRIPTION

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
23       --all-namespaces.
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

OPTIONS

40       -A, --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
43       --namespace.
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       -k, --kustomize=""
79           Process the kustomization directory. This flag can't be used
80       together with -f or -R.
81
82
83       -L, --label-columns=[]
84           Accepts a comma separated list of labels that are going to be
85       presented as columns. Names are case-sensitive. You can also use
86       multiple flag options like -L label1 -L label2...
87
88
89       --no-headers=false
90           When using the default or custom-column output format, don't print
91       headers (default print headers).
92
93
94       -o, --output=""
95           Output format. One of:
96       json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=...
97       See custom columns [ ⟨http://kubernetes.io/docs/user-guide/kubectl-
98       overview/#custom-columns⟩], golang template [
99http://golang.org/pkg/text/template/#pkg-overview⟩] and jsonpath
100       template [ ⟨http://kubernetes.io/docs/user-guide/jsonpath⟩].
101
102
103       --output-watch-events=false
104           Output watch event objects when --watch or --watch-only is used.
105       Existing objects are output as initial ADDED events.
106
107
108       --raw=""
109           Raw URI to request from the server.  Uses the transport specified
110       by the kubeconfig file.
111
112
113       -R, --recursive=false
114           Process the directory used in -f, --filename recursively. Useful
115       when you want to manage related manifests organized within the same
116       directory.
117
118
119       -l, --selector=""
120           Selector (label query) to filter on, supports '=', '==', and
121       '!='.(e.g. -l key1=value1,key2=value2)
122
123
124       --server-print=true
125           If true, have the server return the appropriate table output.
126       Supports extension APIs and CRDs.
127
128
129       --show-kind=false
130           If present, list the resource type for the requested object(s).
131
132
133       --show-labels=false
134           When printing, show all labels as the last column (default hide
135       labels column)
136
137
138       --sort-by=""
139           If non-empty, sort list types using this field specification.  The
140       field specification is expressed as a JSONPath expression (e.g.
141       '{.metadata.name}'). The field in the API resource specified by this
142       JSONPath expression must be an integer or a string.
143
144
145       --template=""
146           Template string or path to template file to use when
147       -o=go-template, -o=go-template-file. The template format is golang
148       templates [ ⟨http://golang.org/pkg/text/template/#pkg-overview⟩].
149
150
151       --use-openapi-print-columns=false
152           If true, use x-kubernetes-print-column metadata (if present) from
153       the OpenAPI schema for displaying a resource.
154
155
156       -w, --watch=false
157           After listing/getting the requested object, watch for changes.
158       Uninitialized objects are excluded if no object name is provided.
159
160
161       --watch-only=false
162           Watch for changes to the requested object(s), without
163       listing/getting first.
164
165
166

OPTIONS INHERITED FROM PARENT COMMANDS

168       --add-dir-header=false
169           If true, adds the file directory to the header
170
171
172       --alsologtostderr=false
173           log to standard error as well as files
174
175
176       --application-metrics-count-limit=100
177           Max number of application metrics to store (per container)
178
179
180       --as=""
181           Username to impersonate for the operation
182
183
184       --as-group=[]
185           Group to impersonate for the operation, this flag can be repeated
186       to specify multiple groups.
187
188
189       --azure-container-registry-config=""
190           Path to the file containing Azure container registry configuration
191       information.
192
193
194       --boot-id-file="/proc/sys/kernel/random/boot_id"
195           Comma-separated list of files to check for boot-id. Use the first
196       one that exists.
197
198
199       --cache-dir="/builddir/.kube/http-cache"
200           Default HTTP cache directory
201
202
203       --certificate-authority=""
204           Path to a cert file for the certificate authority
205
206
207       --client-certificate=""
208           Path to a client certificate file for TLS
209
210
211       --client-key=""
212           Path to a client key file for TLS
213
214
215       --cloud-provider-gce-l7lb-src-cidrs=130.211.0.0/22,35.191.0.0/16
216           CIDRs opened in GCE firewall for L7 LB traffic proxy  health checks
217
218
219       --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
220           CIDRs opened in GCE firewall for L4 LB traffic proxy  health checks
221
222
223       --cluster=""
224           The name of the kubeconfig cluster to use
225
226
227       --container-hints="/etc/cadvisor/container_hints.json"
228           location of the container hints file
229
230
231       --containerd="/run/containerd/containerd.sock"
232           containerd endpoint
233
234
235       --containerd-namespace="k8s.io"
236           containerd namespace
237
238
239       --context=""
240           The name of the kubeconfig context to use
241
242
243       --default-not-ready-toleration-seconds=300
244           Indicates the tolerationSeconds of the toleration for
245       notReady:NoExecute that is added by default to every pod that does not
246       already have such a toleration.
247
248
249       --default-unreachable-toleration-seconds=300
250           Indicates the tolerationSeconds of the toleration for
251       unreachable:NoExecute that is added by default to every pod that does
252       not already have such a toleration.
253
254
255       --disable-root-cgroup-stats=false
256           Disable collecting root Cgroup stats
257
258
259       --docker="unix:///var/run/docker.sock"
260           docker endpoint
261
262
263       --docker-env-metadata-whitelist=""
264           a comma-separated list of environment variable keys that needs to
265       be collected for docker containers
266
267
268       --docker-only=false
269           Only report docker containers in addition to root stats
270
271
272       --docker-root="/var/lib/docker"
273           DEPRECATED: docker root is read from docker info (this is a
274       fallback, default: /var/lib/docker)
275
276
277       --docker-tls=false
278           use TLS to connect to docker
279
280
281       --docker-tls-ca="ca.pem"
282           path to trusted CA
283
284
285       --docker-tls-cert="cert.pem"
286           path to client certificate
287
288
289       --docker-tls-key="key.pem"
290           path to private key
291
292
293       --enable-load-reader=false
294           Whether to enable cpu load reader
295
296
297       --event-storage-age-limit="default=0"
298           Max length of time for which to store events (per type). Value is a
299       comma separated list of key values, where the keys are event types
300       (e.g.: creation, oom) or "default" and the value is a duration. Default
301       is applied to all non-specified event types
302
303
304       --event-storage-event-limit="default=0"
305           Max number of events to store (per type). Value is a comma
306       separated list of key values, where the keys are event types (e.g.:
307       creation, oom) or "default" and the value is an integer. Default is
308       applied to all non-specified event types
309
310
311       --global-housekeeping-interval=1m0s
312           Interval between global housekeepings
313
314
315       --housekeeping-interval=10s
316           Interval between container housekeepings
317
318
319       --insecure-skip-tls-verify=false
320           If true, the server's certificate will not be checked for validity.
321       This will make your HTTPS connections insecure
322
323
324       --kubeconfig=""
325           Path to the kubeconfig file to use for CLI requests.
326
327
328       --log-backtrace-at=:0
329           when logging hits line file:N, emit a stack trace
330
331
332       --log-cadvisor-usage=false
333           Whether to log the usage of the cAdvisor container
334
335
336       --log-dir=""
337           If non-empty, write log files in this directory
338
339
340       --log-file=""
341           If non-empty, use this log file
342
343
344       --log-file-max-size=1800
345           Defines the maximum size a log file can grow to. Unit is megabytes.
346       If the value is 0, the maximum file size is unlimited.
347
348
349       --log-flush-frequency=5s
350           Maximum number of seconds between log flushes
351
352
353       --logtostderr=true
354           log to standard error instead of files
355
356
357       --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
358           Comma-separated list of files to check for machine-id. Use the
359       first one that exists.
360
361
362       --match-server-version=false
363           Require server version to match client version
364
365
366       -n, --namespace=""
367           If present, the namespace scope for this CLI request
368
369
370       --password=""
371           Password for basic authentication to the API server
372
373
374       --profile="none"
375           Name of profile to capture. One of
376       (none|cpu|heap|goroutine|threadcreate|block|mutex)
377
378
379       --profile-output="profile.pprof"
380           Name of the file to write the profile to
381
382
383       --request-timeout="0"
384           The length of time to wait before giving up on a single server
385       request. Non-zero values should contain a corresponding time unit (e.g.
386       1s, 2m, 3h). A value of zero means don't timeout requests.
387
388
389       -s, --server=""
390           The address and port of the Kubernetes API server
391
392
393       --skip-headers=false
394           If true, avoid header prefixes in the log messages
395
396
397       --skip-log-headers=false
398           If true, avoid headers when opening log files
399
400
401       --stderrthreshold=2
402           logs at or above this threshold go to stderr
403
404
405       --storage-driver-buffer-duration=1m0s
406           Writes in the storage driver will be buffered for this duration,
407       and committed to the non memory backends as a single transaction
408
409
410       --storage-driver-db="cadvisor"
411           database name
412
413
414       --storage-driver-host="localhost:8086"
415           database host:port
416
417
418       --storage-driver-password="root"
419           database password
420
421
422       --storage-driver-secure=false
423           use secure connection with database
424
425
426       --storage-driver-table="stats"
427           table name
428
429
430       --storage-driver-user="root"
431           database username
432
433
434       --tls-server-name=""
435           Server name to use for server certificate validation. If it is not
436       provided, the hostname used to contact the server is used
437
438
439       --token=""
440           Bearer token for authentication to the API server
441
442
443       --update-machine-info-interval=5m0s
444           Interval between machine info updates.
445
446
447       --user=""
448           The name of the kubeconfig user to use
449
450
451       --username=""
452           Username for basic authentication to the API server
453
454
455       -v, --v=0
456           number for the log level verbosity
457
458
459       --version=false
460           Print version information and quit
461
462
463       --vmodule=
464           comma-separated list of pattern=N settings for file-filtered
465       logging
466
467
468

EXAMPLE

470                # List all pods in ps output format.
471                kubectl get pods
472
473                # List all pods in ps output format with more information (such as node name).
474                kubectl get pods -o wide
475
476                # List a single replication controller with specified NAME in ps output format.
477                kubectl get replicationcontroller web
478
479                # List deployments in JSON output format, in the "v1" version of the "apps" API group:
480                kubectl get deployments.v1.apps -o json
481
482                # List a single pod in JSON output format.
483                kubectl get -o json pod web-pod-13je7
484
485                # List a pod identified by type and name specified in "pod.yaml" in JSON output format.
486                kubectl get -f pod.yaml -o json
487
488                # List resources from a directory with kustomization.yaml - e.g. dir/kustomization.yaml.
489                kubectl get -k dir/
490
491                # Return only the phase value of the specified pod.
492                kubectl get -o template pod/web-pod-13je7 --template={{.status.phase}}
493
494                # List resource information in custom columns.
495                kubectl get pod test-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image
496
497                # List all replication controllers and services together in ps output format.
498                kubectl get rc,services
499
500                # List one or more resources by their type and names.
501                kubectl get rc/web service/frontend pods/web-pod-13je7
502
503
504
505

SEE ALSO

507       kubectl(1),
508
509
510

HISTORY

512       January 2015, Originally compiled by Eric Paris (eparis at redhat dot
513       com) based on the kubernetes source material, but hopefully they have
514       been automatically generated since!
515
516
517
518Eric Paris                  kubernetes User Manuals              KUBERNETES(1)
Impressum