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

EXAMPLE

431                # List all pods in ps output format.
432                kubectl get pods
433
434                # List all pods in ps output format with more information (such as node name).
435                kubectl get pods -o wide
436
437                # List a single replication controller with specified NAME in ps output format.
438                kubectl get replicationcontroller web
439
440                # List deployments in JSON output format, in the "v1" version of the "apps" API group:
441                kubectl get deployments.v1.apps -o json
442
443                # List a single pod in JSON output format.
444                kubectl get -o json pod web-pod-13je7
445
446                # List a pod identified by type and name specified in "pod.yaml" in JSON output format.
447                kubectl get -f pod.yaml -o json
448
449                # Return only the phase value of the specified pod.
450                kubectl get -o template pod/web-pod-13je7 --template={{.status.phase}}
451
452                # List all replication controllers and services together in ps output format.
453                kubectl get rc,services
454
455                # List one or more resources by their type and names.
456                kubectl get rc/web service/frontend pods/web-pod-13je7
457
458
459
460

SEE ALSO

462       kubectl(1),
463
464
465

HISTORY

467       January 2015, Originally compiled by Eric Paris (eparis at  redhat  dot
468       com)  based  on the kubernetes source material, but hopefully they have
469       been automatically generated since!
470
471
472
473Eric Paris                  kubernetes User Manuals              KUBERNETES(1)
Impressum