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

NAME

9       kubectl set env - Update environment variables on a pod template
10
11
12

SYNOPSIS

14       kubectl set env [OPTIONS]
15
16
17

DESCRIPTION

19       Update environment variables on a pod template.
20
21
22       List  environment  variable  definitions  in one or more pods, pod tem‐
23       plates. Add, update, or remove container environment  variable  defini‐
24       tions  in  one or more pod templates (within replication controllers or
25       deployment configurations). View or  modify  the  environment  variable
26       definitions  on  all containers in the specified pods or pod templates,
27       or just those that match a wildcard.
28
29
30       If "--env -" is passed, environment variables can be  read  from  STDIN
31       using the standard env syntax.
32
33
34       Possible resources include (case insensitive):
35
36
37       pod  (po),  replicationcontroller  (rc), deployment (deploy), daemonset
38       (ds), job, replicaset (rs)
39
40
41

OPTIONS

43       --all=false      If true, select all resources in the namespace of  the
44       specified resource types
45
46
47       --allow-missing-template-keys=true       If  true, ignore any errors in
48       templates when a field or map key is missing in the template. Only  ap‐
49       plies to golang and jsonpath output formats.
50
51
52       -c,  --containers="*"       The names of containers in the selected pod
53       templates to change - may use wildcards
54
55
56       --dry-run="none"      Must be "none", "server", or "client". If  client
57       strategy, only print the object that would be sent, without sending it.
58       If server strategy, submit server-side request without  persisting  the
59       resource.
60
61
62       -e,  --env=[]      Specify a key-value pair for an environment variable
63       to set into each container.
64
65
66       --field-manager="kubectl-set"      Name of the manager  used  to  track
67       field ownership.
68
69
70       -f,  --filename=[]       Filename,  directory,  or URL to files the re‐
71       source to update the env
72
73
74       --from=""      The name of a resource from which to inject  environment
75       variables
76
77
78       --keys=[]       Comma-separated  list  of keys to import from specified
79       resource
80
81
82       -k, --kustomize=""      Process the kustomization directory. This  flag
83       can't be used together with -f or -R.
84
85
86       --list=false       If  true, display the environment and any changes in
87       the standard format. this flag will removed when we have  kubectl  view
88       env.
89
90
91       --local=false      If true, set env will NOT contact api-server but run
92       locally.
93
94
95       -o, --output=""       Output  format.  One  of:  json|yaml|name|go-tem‐
96       plate|go-template-file|template|templatefile|jsonpath|json‐
97       path-as-json|jsonpath-file.
98
99
100       --overwrite=true      If true, allow  environment  to  be  overwritten,
101       otherwise reject updates that overwrite existing environment.
102
103
104       --prefix=""      Prefix to append to variable names
105
106
107       -R, --recursive=false      Process the directory used in -f, --filename
108       recursively. Useful when you want to manage related manifests organized
109       within the same directory.
110
111
112       --resolve=false       If true, show secret or configmap references when
113       listing variables
114
115
116       -l, --selector=""      Selector (label query) to filter on
117
118
119       --template=""      Template string or path to template file to use when
120       -o=go-template, -o=go-template-file. The template format is golang tem‐
121       plates [http://golang.org/pkg/text/template/#pkg-overview].
122
123
124

OPTIONS INHERITED FROM PARENT COMMANDS

126       --add-dir-header=false      If true, adds the  file  directory  to  the
127       header of the log messages
128
129
130       --alsologtostderr=false      log to standard error as well as files
131
132
133       --application-metrics-count-limit=100       Max  number  of application
134       metrics to store (per container)
135
136
137       --as=""      Username to impersonate for the operation
138
139
140       --as-group=[]      Group to impersonate for the  operation,  this  flag
141       can be repeated to specify multiple groups.
142
143
144       --azure-container-registry-config=""       Path  to the file containing
145       Azure container registry configuration information.
146
147
148       --boot-id-file="/proc/sys/kernel/random/boot_id"        Comma-separated
149       list of files to check for boot-id. Use the first one that exists.
150
151
152       --cache-dir="/builddir/.kube/cache"      Default cache directory
153
154
155       --certificate-authority=""      Path to a cert file for the certificate
156       authority
157
158
159       --client-certificate=""      Path to a client certificate file for TLS
160
161
162       --client-key=""      Path to a client key file for TLS
163
164
165       --cloud-provider-gce-l7lb-src-cidrs=130.211.0.0/22,35.191.0.0/16
166            CIDRs  opened  in  GCE  firewall  for  L7 LB traffic proxy  health
167       checks
168
169
170       --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
171            CIDRs  opened  in  GCE  firewall  for  L4 LB traffic proxy  health
172       checks
173
174
175       --cluster=""      The name of the kubeconfig cluster to use
176
177
178       --container-hints="/etc/cadvisor/container_hints.json"      location of
179       the container hints file
180
181
182       --containerd="/run/containerd/containerd.sock"      containerd endpoint
183
184
185       --containerd-namespace="k8s.io"      containerd namespace
186
187
188       --context=""      The name of the kubeconfig context to use
189
190
191       --default-not-ready-toleration-seconds=300       Indicates  the tolera‐
192       tionSeconds of the toleration for notReady:NoExecute that is  added  by
193       default to every pod that does not already have such a toleration.
194
195
196       --default-unreachable-toleration-seconds=300      Indicates the tolera‐
197       tionSeconds of the toleration for unreachable:NoExecute that  is  added
198       by default to every pod that does not already have such a toleration.
199
200
201       --disable-root-cgroup-stats=false       Disable  collecting root Cgroup
202       stats
203
204
205       --docker="unix:///var/run/docker.sock"      docker endpoint
206
207
208       --docker-env-metadata-whitelist=""      a comma-separated list of envi‐
209       ronment  variable  keys  matched with specified prefix that needs to be
210       collected for docker containers
211
212
213       --docker-only=false      Only report docker containers in  addition  to
214       root stats
215
216
217       --docker-root="/var/lib/docker"       DEPRECATED:  docker  root is read
218       from docker info (this is a fallback, default: /var/lib/docker)
219
220
221       --docker-tls=false      use TLS to connect to docker
222
223
224       --docker-tls-ca="ca.pem"      path to trusted CA
225
226
227       --docker-tls-cert="cert.pem"      path to client certificate
228
229
230       --docker-tls-key="key.pem"      path to private key
231
232
233       --enable-load-reader=false      Whether to enable cpu load reader
234
235
236       --event-storage-age-limit="default=0"      Max length of time for which
237       to store events (per type). Value is a comma separated list of key val‐
238       ues, where the keys are event types (e.g.: creation, oom) or  "default"
239       and  the  value  is a duration. Default is applied to all non-specified
240       event types
241
242
243       --event-storage-event-limit="default=0"      Max number  of  events  to
244       store  (per type). Value is a comma separated list of key values, where
245       the keys are event types (e.g.: creation, oom)  or  "default"  and  the
246       value  is  an  integer.  Default  is applied to all non-specified event
247       types
248
249
250       --global-housekeeping-interval=1m0s      Interval between global house‐
251       keepings
252
253
254       --housekeeping-interval=10s       Interval between container housekeep‐
255       ings
256
257
258       --insecure-skip-tls-verify=false      If true, the server's certificate
259       will not be checked for validity. This will make your HTTPS connections
260       insecure
261
262
263       --kubeconfig=""      Path to the kubeconfig file to  use  for  CLI  re‐
264       quests.
265
266
267       --log-backtrace-at=:0       when logging hits line file:N, emit a stack
268       trace
269
270
271       --log-cadvisor-usage=false      Whether to log the usage of the  cAdvi‐
272       sor container
273
274
275       --log-dir=""      If non-empty, write log files in this directory
276
277
278       --log-file=""      If non-empty, use this log file
279
280
281       --log-file-max-size=1800       Defines  the maximum size a log file can
282       grow to. Unit is megabytes. If the value is 0, the maximum file size is
283       unlimited.
284
285
286       --log-flush-frequency=5s       Maximum  number  of  seconds between log
287       flushes
288
289
290       --logtostderr=true      log to standard error instead of files
291
292
293       --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
294            Comma-separated  list  of  files  to check for machine-id. Use the
295       first one that exists.
296
297
298       --match-server-version=false       Require  server  version  to   match
299       client version
300
301
302       -n,  --namespace=""       If  present, the namespace scope for this CLI
303       request
304
305
306       --one-output=false      If true, only write logs to their native sever‐
307       ity level (vs also writing to each lower severity level
308
309
310       --password=""      Password for basic authentication to the API server
311
312
313       --profile="none"         Name   of   profile   to   capture.   One   of
314       (none|cpu|heap|goroutine|threadcreate|block|mutex)
315
316
317       --profile-output="profile.pprof"      Name of the  file  to  write  the
318       profile to
319
320
321       --referenced-reset-interval=0       Reset interval for referenced bytes
322       (container_referenced_bytes metric), number of measurement cycles after
323       which  referenced  bytes  are cleared, if set to 0 referenced bytes are
324       never cleared (default: 0)
325
326
327       --request-timeout="0"      The length of time to wait before giving  up
328       on  a  single  server  request. Non-zero values should contain a corre‐
329       sponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't time‐
330       out requests.
331
332
333       -s, --server=""      The address and port of the Kubernetes API server
334
335
336       --skip-headers=false       If  true,  avoid  header prefixes in the log
337       messages
338
339
340       --skip-log-headers=false      If true, avoid headers when  opening  log
341       files
342
343
344       --stderrthreshold=2      logs at or above this threshold go to stderr
345
346
347       --storage-driver-buffer-duration=1m0s      Writes in the storage driver
348       will be buffered for this duration, and committed  to  the  non  memory
349       backends as a single transaction
350
351
352       --storage-driver-db="cadvisor"      database name
353
354
355       --storage-driver-host="localhost:8086"      database host:port
356
357
358       --storage-driver-password="root"      database password
359
360
361       --storage-driver-secure=false      use secure connection with database
362
363
364       --storage-driver-table="stats"      table name
365
366
367       --storage-driver-user="root"      database username
368
369
370       --tls-server-name=""       Server  name  to  use for server certificate
371       validation. If it is not provided, the hostname  used  to  contact  the
372       server is used
373
374
375       --token=""      Bearer token for authentication to the API server
376
377
378       --update-machine-info-interval=5m0s       Interval between machine info
379       updates.
380
381
382       --user=""      The name of the kubeconfig user to use
383
384
385       --username=""      Username for basic authentication to the API server
386
387
388       -v, --v=0      number for the log level verbosity
389
390
391       --version=false      Print version information and quit
392
393
394       --vmodule=       comma-separated  list  of   pattern=N   settings   for
395       file-filtered logging
396
397
398       --warnings-as-errors=false      Treat warnings received from the server
399       as errors and exit with a non-zero exit code
400
401
402

EXAMPLE

404                # Update deployment 'registry' with a new environment variable
405                kubectl set env deployment/registry STORAGE_DIR=/local
406
407                # List the environment variables defined on a deployments 'sample-build'
408                kubectl set env deployment/sample-build --list
409
410                # List the environment variables defined on all pods
411                kubectl set env pods --all --list
412
413                # Output modified deployment in YAML, and does not alter the object on the server
414                kubectl set env deployment/sample-build STORAGE_DIR=/data -o yaml
415
416                # Update all containers in all replication controllers in the project to have ENV=prod
417                kubectl set env rc --all ENV=prod
418
419                # Import environment from a secret
420                kubectl set env --from=secret/mysecret deployment/myapp
421
422                # Import environment from a config map with a prefix
423                kubectl set env --from=configmap/myconfigmap --prefix=MYSQL_ deployment/myapp
424
425                # Import specific keys from a config map
426                kubectl set env --keys=my-example-key --from=configmap/myconfigmap deployment/myapp
427
428                # Remove the environment variable ENV from container 'c1' in all deployment configs
429                kubectl set env deployments --all --containers="c1" ENV-
430
431                # Remove the environment variable ENV from a deployment definition on disk and
432                # update the deployment config on the server
433                kubectl set env -f deploy.json ENV-
434
435                # Set some of the local shell environment into a deployment config on the server
436                env | grep RAILS_ | kubectl set env -e - deployment/registry
437
438
439
440

SEE ALSO

442       kubectl-set(1),
443
444
445

HISTORY

447       January 2015, Originally compiled by Eric Paris (eparis at  redhat  dot
448       com)  based  on the kubernetes source material, but hopefully they have
449       been automatically generated since!
450
451
452
453Manuals                              User            KUBERNETES(1)(kubernetes)
Impressum