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       --list=false
79           If true, display the environment and any changes  in  the  standard
80       format. this flag will removed when we have kubectl view env.
81
82
83       --local=false
84           If true, set env will NOT contact api-server but run locally.
85
86
87       -o, --output=""
88           Output    format.    One   of:   json|yaml|name|go-template|go-tem‐
89       plate-file|template|templatefile|jsonpath|jsonpath-file.
90
91
92       --overwrite=true
93           If true, allow environment  to  be  overwritten,  otherwise  reject
94       updates that overwrite existing environment.
95
96
97       --prefix=""
98           Prefix to append to variable names
99
100
101       -R, --recursive=false
102           Process  the  directory  used in -f, --filename recursively. Useful
103       when you want to manage related manifests  organized  within  the  same
104       directory.
105
106
107       --resolve=false
108           If true, show secret or configmap references when listing variables
109
110
111       -l, --selector=""
112           Selector (label query) to filter on
113
114
115       --template=""
116           Template  string  or  path  to template file to use when -o=go-tem‐
117       plate, -o=go-template-file. The template format is golang  templates  [
118http://golang.org/pkg/text/template/#pkg-overview⟩].
119
120
121

OPTIONS INHERITED FROM PARENT COMMANDS

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

EXAMPLE

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

SEE ALSO

437       kubectl-set(1),
438
439
440

HISTORY

442       January 2015, Originally compiled by Eric Paris (eparis at  redhat  dot
443       com)  based  on the kubernetes source material, but hopefully they have
444       been automatically generated since!
445
446
447
448Eric Paris                  kubernetes User Manuals              KUBERNETES(1)
Impressum