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 --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

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 --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       -k, --kustomize=""
86           Process  the  kustomization  directory.  This  flag  can't  be used
87       together with -f or -R.
88
89
90       -L, --label-columns=[]
91           Accepts a comma separated list of labels that are going to be  pre‐
92       sented  as columns. Names are case-sensitive. You can also use multiple
93       flag options like -L label1 -L label2...
94
95
96       --no-headers=false
97           When using the default or custom-column output format, don't  print
98       headers (default print headers).
99
100
101       -o, --output=""
102           Output  format. One of: json|yaml|wide|name|custom-columns=...|cus‐
103       tom-columns-file=...|go-template=...|go-template-file=...|json‐
104       path=...|jsonpath-file=...   See   custom   columns   [  ⟨http://kuber
105       netes.io/docs/user-guide/kubectl-overview/#custom-columns⟩],     golang
106       template   [  ⟨http://golang.org/pkg/text/template/#pkg-overview⟩]  and
107       jsonpath template [ ⟨http://kubernetes.io/docs/user-guide/jsonpath⟩].
108
109
110       --raw=""
111           Raw URI to request from the server.  Uses the  transport  specified
112       by the kubeconfig file.
113
114
115       -R, --recursive=false
116           Process  the  directory  used in -f, --filename recursively. Useful
117       when you want to manage related manifests  organized  within  the  same
118       directory.
119
120
121       -l, --selector=""
122           Selector  (label  query)  to  filter  on,  supports  '=', '==', and
123       '!='.(e.g. -l key1=value1,key2=value2)
124
125
126       --server-print=true
127           If true, have the server return the appropriate table output.  Sup‐
128       ports extension APIs and CRDs.
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  [
150http://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

OPTIONS INHERITED FROM PARENT COMMANDS

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="/run/containerd/containerd.sock"
226           containerd endpoint
227
228
229       --containerd-namespace="k8s.io"
230           containerd namespace
231
232
233       --context=""
234           The name of the kubeconfig context to use
235
236
237       --default-not-ready-toleration-seconds=300
238           Indicates   the   tolerationSeconds   of   the    toleration    for
239       notReady:NoExecute  that is added by default to every pod that does not
240       already have such a toleration.
241
242
243       --default-unreachable-toleration-seconds=300
244           Indicates the tolerationSeconds  of  the  toleration  for  unreach‐
245       able:NoExecute  that  is  added  by  default to every pod that does not
246       already have such a toleration.
247
248
249       --docker="unix:///var/run/docker.sock"
250           docker endpoint
251
252
253       --docker-env-metadata-whitelist=""
254           a comma-separated list of environment variable keys that  needs  to
255       be collected for docker containers
256
257
258       --docker-only=false
259           Only report docker containers in addition to root stats
260
261
262       --docker-root="/var/lib/docker"
263           DEPRECATED:  docker  root is read from docker info (this is a fall‐
264       back, default: /var/lib/docker)
265
266
267       --docker-tls=false
268           use TLS to connect to docker
269
270
271       --docker-tls-ca="ca.pem"
272           path to trusted CA
273
274
275       --docker-tls-cert="cert.pem"
276           path to client certificate
277
278
279       --docker-tls-key="key.pem"
280           path to private key
281
282
283       --enable-load-reader=false
284           Whether to enable cpu load reader
285
286
287       --event-storage-age-limit="default=0"
288           Max length of time for which to store events (per type). Value is a
289       comma  separated  list  of  key  values, where the keys are event types
290       (e.g.: creation, oom) or "default" and the value is a duration. Default
291       is applied to all non-specified event types
292
293
294       --event-storage-event-limit="default=0"
295           Max  number  of  events to store (per type). Value is a comma sepa‐
296       rated list of key values, where the keys are event  types  (e.g.:  cre‐
297       ation,  oom)  or  "default"  and  the  value  is an integer. Default is
298       applied to all non-specified event types
299
300
301       --global-housekeeping-interval=1m0s
302           Interval between global housekeepings
303
304
305       --housekeeping-interval=10s
306           Interval between container housekeepings
307
308
309       --insecure-skip-tls-verify=false
310           If true, the server's certificate will not be checked for validity.
311       This will make your HTTPS connections insecure
312
313
314       --kubeconfig=""
315           Path to the kubeconfig file to use for CLI requests.
316
317
318       --log-backtrace-at=:0
319           when logging hits line file:N, emit a stack trace
320
321
322       --log-cadvisor-usage=false
323           Whether to log the usage of the cAdvisor container
324
325
326       --log-dir=""
327           If non-empty, write log files in this directory
328
329
330       --log-file=""
331           If non-empty, use this log file
332
333
334       --log-file-max-size=1800
335           Defines the maximum size a log file can grow to. Unit is megabytes.
336       If the value is 0, the maximum file size is unlimited.
337
338
339       --log-flush-frequency=5s
340           Maximum number of seconds between log flushes
341
342
343       --logtostderr=true
344           log to standard error instead of files
345
346
347       --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
348           Comma-separated list of files to  check  for  machine-id.  Use  the
349       first one that exists.
350
351
352       --match-server-version=false
353           Require server version to match client version
354
355
356       -n, --namespace=""
357           If present, the namespace scope for this CLI request
358
359
360       --password=""
361           Password for basic authentication to the API server
362
363
364       --profile="none"
365           Name of profile to capture. One of (none|cpu|heap|goroutine|thread‐
366       create|block|mutex)
367
368
369       --profile-output="profile.pprof"
370           Name of the file to write the profile to
371
372
373       --request-timeout="0"
374           The length of time to wait before giving  up  on  a  single  server
375       request. Non-zero values should contain a corresponding time unit (e.g.
376       1s, 2m, 3h). A value of zero means don't timeout requests.
377
378
379       -s, --server=""
380           The address and port of the Kubernetes API server
381
382
383       --skip-headers=false
384           If true, avoid header prefixes in the log messages
385
386
387       --skip-log-headers=false
388           If true, avoid headers when opening log files
389
390
391       --stderrthreshold=2
392           logs at or above this threshold go to stderr
393
394
395       --storage-driver-buffer-duration=1m0s
396           Writes in the storage driver will be buffered  for  this  duration,
397       and committed to the non memory backends as a single transaction
398
399
400       --storage-driver-db="cadvisor"
401           database name
402
403
404       --storage-driver-host="localhost:8086"
405           database host:port
406
407
408       --storage-driver-password="root"
409           database password
410
411
412       --storage-driver-secure=false
413           use secure connection with database
414
415
416       --storage-driver-table="stats"
417           table name
418
419
420       --storage-driver-user="root"
421           database username
422
423
424       --token=""
425           Bearer token for authentication to the API server
426
427
428       --update-machine-info-interval=5m0s
429           Interval between machine info updates.
430
431
432       --user=""
433           The name of the kubeconfig user to use
434
435
436       --username=""
437           Username for basic authentication to the API server
438
439
440       -v, --v=0
441           number for the log level verbosity
442
443
444       --version=false
445           Print version information and quit
446
447
448       --vmodule=
449           comma-separated  list  of pattern=N settings for file-filtered log‐
450       ging
451
452
453

EXAMPLE

455                # List all pods in ps output format.
456                kubectl get pods
457
458                # List all pods in ps output format with more information (such as node name).
459                kubectl get pods -o wide
460
461                # List a single replication controller with specified NAME in ps output format.
462                kubectl get replicationcontroller web
463
464                # List deployments in JSON output format, in the "v1" version of the "apps" API group:
465                kubectl get deployments.v1.apps -o json
466
467                # List a single pod in JSON output format.
468                kubectl get -o json pod web-pod-13je7
469
470                # List a pod identified by type and name specified in "pod.yaml" in JSON output format.
471                kubectl get -f pod.yaml -o json
472
473                # List resources from a directory with kustomization.yaml - e.g. dir/kustomization.yaml.
474                kubectl get -k dir/
475
476                # Return only the phase value of the specified pod.
477                kubectl get -o template pod/web-pod-13je7 --template={{.status.phase}}
478
479                # List resource information in custom columns.
480                kubectl get pod test-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image
481
482                # List all replication controllers and services together in ps output format.
483                kubectl get rc,services
484
485                # List one or more resources by their type and names.
486                kubectl get rc/web service/frontend pods/web-pod-13je7
487
488
489
490

SEE ALSO

492       kubectl(1),
493
494
495

HISTORY

497       January 2015, Originally compiled by Eric Paris (eparis at  redhat  dot
498       com)  based  on the kubernetes source material, but hopefully they have
499       been automatically generated since!
500
501
502
503Eric Paris                  kubernetes User Manuals              KUBERNETES(1)
Impressum