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

NAME

9       kubectl  completion  -  Output  shell completion code for the specified
10       shell (bash or zsh)
11
12
13

SYNOPSIS

15       kubectl completion [OPTIONS]
16
17
18

DESCRIPTION

20       Output shell completion code for the specified shell (bash or zsh). The
21       shell  code  must  be  evaluated  to  provide interactive completion of
22       kubectl commands.  This can be done by sourcing it from the  .bash_pro‐
23       file.
24
25
26       Detailed instructions on how to do this are available here: https://ku
27       bernetes.io/docs/tasks/tools/install-kubectl/#enabling-shell-autocom‐
28       pletion
29
30
31       Note  for zsh users: [1] zsh completions are only supported in versions
32       of zsh >= 5.2
33
34
35

OPTIONS INHERITED FROM PARENT COMMANDS

37       --add-dir-header=false      If true, adds the  file  directory  to  the
38       header of the log messages
39
40
41       --alsologtostderr=false      log to standard error as well as files
42
43
44       --application-metrics-count-limit=100       Max  number  of application
45       metrics to store (per container)
46
47
48       --as=""      Username to impersonate for the operation
49
50
51       --as-group=[]      Group to impersonate for the  operation,  this  flag
52       can be repeated to specify multiple groups.
53
54
55       --azure-container-registry-config=""       Path  to the file containing
56       Azure container registry configuration information.
57
58
59       --boot-id-file="/proc/sys/kernel/random/boot_id"        Comma-separated
60       list of files to check for boot-id. Use the first one that exists.
61
62
63       --cache-dir="/builddir/.kube/cache"      Default cache directory
64
65
66       --certificate-authority=""      Path to a cert file for the certificate
67       authority
68
69
70       --client-certificate=""      Path to a client certificate file for TLS
71
72
73       --client-key=""      Path to a client key file for TLS
74
75
76       --cloud-provider-gce-l7lb-src-cidrs=130.211.0.0/22,35.191.0.0/16
77            CIDRs  opened  in  GCE  firewall  for  L7 LB traffic proxy  health
78       checks
79
80
81       --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
82            CIDRs  opened  in  GCE  firewall  for  L4 LB traffic proxy  health
83       checks
84
85
86       --cluster=""      The name of the kubeconfig cluster to use
87
88
89       --container-hints="/etc/cadvisor/container_hints.json"      location of
90       the container hints file
91
92
93       --containerd="/run/containerd/containerd.sock"      containerd endpoint
94
95
96       --containerd-namespace="k8s.io"      containerd namespace
97
98
99       --context=""      The name of the kubeconfig context to use
100
101
102       --default-not-ready-toleration-seconds=300       Indicates  the tolera‐
103       tionSeconds of the toleration for notReady:NoExecute that is  added  by
104       default to every pod that does not already have such a toleration.
105
106
107       --default-unreachable-toleration-seconds=300      Indicates the tolera‐
108       tionSeconds of the toleration for unreachable:NoExecute that  is  added
109       by default to every pod that does not already have such a toleration.
110
111
112       --disable-root-cgroup-stats=false       Disable  collecting root Cgroup
113       stats
114
115
116       --docker="unix:///var/run/docker.sock"      docker endpoint
117
118
119       --docker-env-metadata-whitelist=""      a comma-separated list of envi‐
120       ronment  variable  keys  matched with specified prefix that needs to be
121       collected for docker containers
122
123
124       --docker-only=false      Only report docker containers in  addition  to
125       root stats
126
127
128       --docker-root="/var/lib/docker"       DEPRECATED:  docker  root is read
129       from docker info (this is a fallback, default: /var/lib/docker)
130
131
132       --docker-tls=false      use TLS to connect to docker
133
134
135       --docker-tls-ca="ca.pem"      path to trusted CA
136
137
138       --docker-tls-cert="cert.pem"      path to client certificate
139
140
141       --docker-tls-key="key.pem"      path to private key
142
143
144       --enable-load-reader=false      Whether to enable cpu load reader
145
146
147       --event-storage-age-limit="default=0"      Max length of time for which
148       to store events (per type). Value is a comma separated list of key val‐
149       ues, where the keys are event types (e.g.: creation, oom) or  "default"
150       and  the  value  is a duration. Default is applied to all non-specified
151       event types
152
153
154       --event-storage-event-limit="default=0"      Max number  of  events  to
155       store  (per type). Value is a comma separated list of key values, where
156       the keys are event types (e.g.: creation, oom)  or  "default"  and  the
157       value  is  an  integer.  Default  is applied to all non-specified event
158       types
159
160
161       --global-housekeeping-interval=1m0s      Interval between global house‐
162       keepings
163
164
165       --housekeeping-interval=10s       Interval between container housekeep‐
166       ings
167
168
169       --insecure-skip-tls-verify=false      If true, the server's certificate
170       will not be checked for validity. This will make your HTTPS connections
171       insecure
172
173
174       --kubeconfig=""      Path to the kubeconfig file to  use  for  CLI  re‐
175       quests.
176
177
178       --log-backtrace-at=:0       when logging hits line file:N, emit a stack
179       trace
180
181
182       --log-cadvisor-usage=false      Whether to log the usage of the  cAdvi‐
183       sor container
184
185
186       --log-dir=""      If non-empty, write log files in this directory
187
188
189       --log-file=""      If non-empty, use this log file
190
191
192       --log-file-max-size=1800       Defines  the maximum size a log file can
193       grow to. Unit is megabytes. If the value is 0, the maximum file size is
194       unlimited.
195
196
197       --log-flush-frequency=5s       Maximum  number  of  seconds between log
198       flushes
199
200
201       --logtostderr=true      log to standard error instead of files
202
203
204       --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
205            Comma-separated  list  of  files  to check for machine-id. Use the
206       first one that exists.
207
208
209       --match-server-version=false       Require  server  version  to   match
210       client version
211
212
213       -n,  --namespace=""       If  present, the namespace scope for this CLI
214       request
215
216
217       --one-output=false      If true, only write logs to their native sever‐
218       ity level (vs also writing to each lower severity level)
219
220
221       --password=""      Password for basic authentication to the API server
222
223
224       --profile="none"         Name   of   profile   to   capture.   One   of
225       (none|cpu|heap|goroutine|threadcreate|block|mutex)
226
227
228       --profile-output="profile.pprof"      Name of the  file  to  write  the
229       profile to
230
231
232       --referenced-reset-interval=0       Reset interval for referenced bytes
233       (container_referenced_bytes metric), number of measurement cycles after
234       which  referenced  bytes  are cleared, if set to 0 referenced bytes are
235       never cleared (default: 0)
236
237
238       --request-timeout="0"      The length of time to wait before giving  up
239       on  a  single  server  request. Non-zero values should contain a corre‐
240       sponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't time‐
241       out requests.
242
243
244       -s, --server=""      The address and port of the Kubernetes API server
245
246
247       --skip-headers=false       If  true,  avoid  header prefixes in the log
248       messages
249
250
251       --skip-log-headers=false      If true, avoid headers when  opening  log
252       files
253
254
255       --stderrthreshold=2      logs at or above this threshold go to stderr
256
257
258       --storage-driver-buffer-duration=1m0s      Writes in the storage driver
259       will be buffered for this duration, and committed  to  the  non  memory
260       backends as a single transaction
261
262
263       --storage-driver-db="cadvisor"      database name
264
265
266       --storage-driver-host="localhost:8086"      database host:port
267
268
269       --storage-driver-password="root"      database password
270
271
272       --storage-driver-secure=false      use secure connection with database
273
274
275       --storage-driver-table="stats"      table name
276
277
278       --storage-driver-user="root"      database username
279
280
281       --tls-server-name=""       Server  name  to  use for server certificate
282       validation. If it is not provided, the hostname  used  to  contact  the
283       server is used
284
285
286       --token=""      Bearer token for authentication to the API server
287
288
289       --update-machine-info-interval=5m0s       Interval between machine info
290       updates.
291
292
293       --user=""      The name of the kubeconfig user to use
294
295
296       --username=""      Username for basic authentication to the API server
297
298
299       -v, --v=0      number for the log level verbosity
300
301
302       --version=false      Print version information and quit
303
304
305       --vmodule=       comma-separated  list  of   pattern=N   settings   for
306       file-filtered logging
307
308
309       --warnings-as-errors=false      Treat warnings received from the server
310       as errors and exit with a non-zero exit code
311
312
313

EXAMPLE

315                # Installing bash completion on macOS using homebrew
316                ## If running Bash 3.2 included with macOS
317                brew install bash-completion
318                ## or, if running Bash 4.1+
319                brew install bash-completion@2
320                ## If kubectl is installed via homebrew, this should start working immediately.
321                ## If you've installed via other means, you may need add the completion to your completion directory
322                kubectl completion bash > $(brew --prefix)/etc/bash_completion.d/kubectl
323
324
325                # Installing bash completion on Linux
326                ## If bash-completion is not installed on Linux, please install the 'bash-completion' package
327                ## via your distribution's package manager.
328                ## Load the kubectl completion code for bash into the current shell
329                source <(kubectl completion bash)
330                ## Write bash completion code to a file and source it from .bash_profile
331                kubectl completion bash >  /.kube/completion.bash.inc
332                printf "
333                # Kubectl shell completion
334                source '$HOME/.kube/completion.bash.inc'
335                " >> $HOME/.bash_profile
336                source $HOME/.bash_profile
337
338                # Load the kubectl completion code for zsh[1] into the current shell
339                source <(kubectl completion zsh)
340                # Set the kubectl completion code for zsh[1] to autoload on startup
341                kubectl completion zsh > "${fpath[1]}/_kubectl"
342
343
344
345

SEE ALSO

347       kubectl(1),
348
349
350

HISTORY

352       January 2015, Originally compiled by Eric Paris (eparis at  redhat  dot
353       com)  based  on the kubernetes source material, but hopefully they have
354       been automatically generated since!
355
356
357
358Manuals                              User            KUBERNETES(1)(kubernetes)
Impressum