1KUBERNETES(1)(kubernetes)                            KUBERNETES(1)(kubernetes)
2
3
4
5Eric Paris Jan 2015
6
7

NAME

9       kubectl get - Display one or many resources
10
11
12

SYNOPSIS

14       kubectl get [OPTIONS]
15
16
17

DESCRIPTION

19       Display one or many resources.
20
21
22       Prints  a  table  of the most important information about the specified
23       resources. You can filter the list using a label selector and the --se‐
24       lector  flag.  If the desired resource type is namespaced you will only
25       see results in your current namespace unless you pass --all-namespaces.
26
27
28       By specifying the output as 'template' and providing a Go  template  as
29       the  value of the --template flag, you can filter the attributes of the
30       fetched resources.
31
32
33       Use "kubectl api-resources" for a complete list of supported resources.
34
35
36

OPTIONS

38       -A, --all-namespaces=false      If  present,  list  the  requested  ob‐
39       ject(s)  across all namespaces. Namespace in current context is ignored
40       even if specified with --namespace.
41
42
43       --allow-missing-template-keys=true      If true, ignore any  errors  in
44       templates  when a field or map key is missing in the template. Only ap‐
45       plies to golang and jsonpath output formats.
46
47
48       --chunk-size=500      Return large lists in chunks rather than  all  at
49       once.  Pass  0  to disable. This flag is beta and may change in the fu‐
50       ture.
51
52
53       --field-selector=""      Selector (field query) to filter on,  supports
54       '=',  '==',  and  '!='.(e.g. --field-selector key1=value1,key2=value2).
55       The server only supports a limited number of field queries per type.
56
57
58       -f, --filename=[]      Filename, directory, or URL to files identifying
59       the resource to get from a server.
60
61
62       --ignore-not-found=false       If  the  requested object does not exist
63       the command will return exit code 0.
64
65
66       -k, --kustomize=""      Process the kustomization directory. This  flag
67       can't be used together with -f or -R.
68
69
70       -L,  --label-columns=[]       Accepts  a comma separated list of labels
71       that are going to be presented as columns.  Names  are  case-sensitive.
72       You can also use multiple flag options like -L label1 -L label2...
73
74
75       --no-headers=false       When using the default or custom-column output
76       format, don't print headers (default print headers).
77
78
79       -o, --output=""      Output format. One of: (json, yaml, name,  go-tem‐
80       plate, go-template-file, template, templatefile, jsonpath, jsonpath-as-
81       json, jsonpath-file, custom-columns,  custom-columns-file,  wide).  See
82       custom    columns   [https://kubernetes.io/docs/reference/kubectl/over
83       view/#custom-columns], golang template [http://golang.org/pkg/text/tem
84       plate/#pkg-overview]     and    jsonpath    template    [https://kuber
85       netes.io/docs/reference/kubectl/jsonpath/].
86
87
88       --output-watch-events=false       Output  watch  event   objects   when
89       --watch or --watch-only is used. Existing objects are output as initial
90       ADDED events.
91
92
93       --raw=""      Raw URI to request from the server.  Uses  the  transport
94       specified by the kubeconfig file.
95
96
97       -R, --recursive=false      Process the directory used in -f, --filename
98       recursively. Useful when you want to manage related manifests organized
99       within the same directory.
100
101
102       -l,  --selector=""       Selector  (label query) to filter on, supports
103       '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). Matching objects
104       must satisfy all of the specified label constraints.
105
106
107       --server-print=true       If true, have the server return the appropri‐
108       ate table output. Supports extension APIs and CRDs.
109
110
111       --show-kind=false      If present, list the resource type for  the  re‐
112       quested object(s).
113
114
115       --show-labels=false       When  printing,  show  all labels as the last
116       column (default hide labels column)
117
118
119       --show-managed-fields=false      If true, keep the  managedFields  when
120       printing objects in JSON or YAML format.
121
122
123       --sort-by=""      If non-empty, sort list types using this field speci‐
124       fication.  The field specification is expressed as a  JSONPath  expres‐
125       sion (e.g. '{.metadata.name}'). The field in the API resource specified
126       by this JSONPath expression must be an integer or a string.
127
128
129       --subresource=""      If specified, gets the  subresource  of  the  re‐
130       quested  object.  Must be one of [status scale]. This flag is alpha and
131       may change in the future.
132
133
134       --template=""      Template string or path to template file to use when
135       -o=go-template, -o=go-template-file. The template format is golang tem‐
136       plates [http://golang.org/pkg/text/template/#pkg-overview].
137
138
139       --use-openapi-print-columns=false      If true, use x-kubernetes-print-
140       column  metadata  (if present) from the OpenAPI schema for displaying a
141       resource.
142
143
144       -w, --watch=false       After  listing/getting  the  requested  object,
145       watch for changes.
146
147
148       --watch-only=false       Watch  for changes to the requested object(s),
149       without listing/getting first.
150
151
152

OPTIONS INHERITED FROM PARENT COMMANDS

154       --as=""      Username to impersonate for the operation. User could be a
155       regular user or a service account in a namespace.
156
157
158       --as-group=[]       Group  to  impersonate for the operation, this flag
159       can be repeated to specify multiple groups.
160
161
162       --as-uid=""      UID to impersonate for the operation.
163
164
165       --azure-container-registry-config=""      Path to the  file  containing
166       Azure container registry configuration information.
167
168
169       --cache-dir="/builddir/.kube/cache"      Default cache directory
170
171
172       --certificate-authority=""      Path to a cert file for the certificate
173       authority
174
175
176       --client-certificate=""      Path to a client certificate file for TLS
177
178
179       --client-key=""      Path to a client key file for TLS
180
181
182       --cluster=""      The name of the kubeconfig cluster to use
183
184
185       --context=""      The name of the kubeconfig context to use
186
187
188       --insecure-skip-tls-verify=false      If true, the server's certificate
189       will not be checked for validity. This will make your HTTPS connections
190       insecure
191
192
193       --kubeconfig=""      Path to the kubeconfig file to  use  for  CLI  re‐
194       quests.
195
196
197       --match-server-version=false        Require  server  version  to  match
198       client version
199
200
201       -n, --namespace=""      If present, the namespace scope  for  this  CLI
202       request
203
204
205       --password=""      Password for basic authentication to the API server
206
207
208       --profile="none"         Name   of   profile   to   capture.   One   of
209       (none|cpu|heap|goroutine|threadcreate|block|mutex)
210
211
212       --profile-output="profile.pprof"      Name of the  file  to  write  the
213       profile to
214
215
216       --request-timeout="0"       The length of time to wait before giving up
217       on a single server request. Non-zero values  should  contain  a  corre‐
218       sponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't time‐
219       out requests.
220
221
222       -s, --server=""      The address and port of the Kubernetes API server
223
224
225       --tls-server-name=""      Server name to  use  for  server  certificate
226       validation.  If  it  is  not provided, the hostname used to contact the
227       server is used
228
229
230       --token=""      Bearer token for authentication to the API server
231
232
233       --user=""      The name of the kubeconfig user to use
234
235
236       --username=""      Username for basic authentication to the API server
237
238
239       --version=false      Print version information and quit
240
241
242       --warnings-as-errors=false      Treat warnings received from the server
243       as errors and exit with a non-zero exit code
244
245
246

EXAMPLE

248                # List all pods in ps output format
249                kubectl get pods
250
251                # List all pods in ps output format with more information (such as node name)
252                kubectl get pods -o wide
253
254                # List a single replication controller with specified NAME in ps output format
255                kubectl get replicationcontroller web
256
257                # List deployments in JSON output format, in the "v1" version of the "apps" API group
258                kubectl get deployments.v1.apps -o json
259
260                # List a single pod in JSON output format
261                kubectl get -o json pod web-pod-13je7
262
263                # List a pod identified by type and name specified in "pod.yaml" in JSON output format
264                kubectl get -f pod.yaml -o json
265
266                # List resources from a directory with kustomization.yaml - e.g. dir/kustomization.yaml
267                kubectl get -k dir/
268
269                # Return only the phase value of the specified pod
270                kubectl get -o template pod/web-pod-13je7 --template={{.status.phase}}
271
272                # List resource information in custom columns
273                kubectl get pod test-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image
274
275                # List all replication controllers and services together in ps output format
276                kubectl get rc,services
277
278                # List one or more resources by their type and names
279                kubectl get rc/web service/frontend pods/web-pod-13je7
280
281                # List status subresource for a single pod.
282                kubectl get pod web-pod-13je7 --subresource status
283
284
285
286

SEE ALSO

288       kubectl(1),
289
290
291

HISTORY

293       January  2015,  Originally compiled by Eric Paris (eparis at redhat dot
294       com) based on the kubernetes source material, but hopefully  they  have
295       been automatically generated since!
296
297
298
299Manuals                              User            KUBERNETES(1)(kubernetes)
Impressum