1KUBERNETES(1)                      Jan 2015                      KUBERNETES(1)
2
3
4

NAME

6       kubectl set env - Update environment variables on a pod template
7
8
9

SYNOPSIS

11       kubectl set env [OPTIONS]
12
13
14

DESCRIPTION

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

OPTIONS

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

OPTIONS INHERITED FROM PARENT COMMANDS

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

EXAMPLE

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

SEE ALSO

451       kubectl-set(1),
452
453
454

HISTORY

456       January 2015, Originally compiled by Eric Paris (eparis at  redhat  dot
457       com)  based  on the kubernetes source material, but hopefully they have
458       been automatically generated since!
459
460
461
462Eric Paris                  kubernetes User Manuals              KUBERNETES(1)
Impressum