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-file|template‐
89       file|template|go-template|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       --allow-verification-with-non-compliant-keys=false
124           Allow  a  SignatureVerifier  to  use  keys  which  are  technically
125       non-compliant with RFC6962.
126
127
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="unix:///var/run/containerd.sock"
184           containerd endpoint
185
186
187       --context=""
188           The name of the kubeconfig context to use
189
190
191       --default-not-ready-toleration-seconds=300
192           Indicates   the   tolerationSeconds   of   the    toleration    for
193       notReady:NoExecute  that is added by default to every pod that does not
194       already have such a toleration.
195
196
197       --default-unreachable-toleration-seconds=300
198           Indicates the tolerationSeconds  of  the  toleration  for  unreach‐
199       able:NoExecute  that  is  added  by  default to every pod that does not
200       already have such a toleration.
201
202
203       --docker="unix:///var/run/docker.sock"
204           docker endpoint
205
206
207       --docker-env-metadata-whitelist=""
208           a comma-separated list of environment variable keys that  needs  to
209       be collected for docker containers
210
211
212       --docker-only=false
213           Only report docker containers in addition to root stats
214
215
216       --docker-root="/var/lib/docker"
217           DEPRECATED:  docker  root is read from docker info (this is a fall‐
218       back, default: /var/lib/docker)
219
220
221       --docker-tls=false
222           use TLS to connect to docker
223
224
225       --docker-tls-ca="ca.pem"
226           path to trusted CA
227
228
229       --docker-tls-cert="cert.pem"
230           path to client certificate
231
232
233       --docker-tls-key="key.pem"
234           path to private key
235
236
237       --enable-load-reader=false
238           Whether to enable cpu load reader
239
240
241       --event-storage-age-limit="default=0"
242           Max length of time for which to store events (per type). Value is a
243       comma  separated  list  of  key  values, where the keys are event types
244       (e.g.: creation, oom) or "default" and the value is a duration. Default
245       is applied to all non-specified event types
246
247
248       --event-storage-event-limit="default=0"
249           Max  number  of  events to store (per type). Value is a comma sepa‐
250       rated list of key values, where the keys are event  types  (e.g.:  cre‐
251       ation,  oom)  or  "default"  and  the  value  is an integer. Default is
252       applied to all non-specified event types
253
254
255       --global-housekeeping-interval=1m0s
256           Interval between global housekeepings
257
258
259       --google-json-key=""
260           The Google Cloud Platform Service  Account  JSON  Key  to  use  for
261       authentication.
262
263
264       --housekeeping-interval=10s
265           Interval between container housekeepings
266
267
268       --insecure-skip-tls-verify=false
269           If true, the server's certificate will not be checked for validity.
270       This will make your HTTPS connections insecure
271
272
273       --kubeconfig=""
274           Path to the kubeconfig file to use for CLI requests.
275
276
277       --log-backtrace-at=:0
278           when logging hits line file:N, emit a stack trace
279
280
281       --log-cadvisor-usage=false
282           Whether to log the usage of the cAdvisor container
283
284
285       --log-dir=""
286           If non-empty, write log files in this directory
287
288
289       --log-flush-frequency=5s
290           Maximum number of seconds between log flushes
291
292
293       --logtostderr=true
294           log to standard error instead of files
295
296
297       --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
298           Comma-separated list of files to  check  for  machine-id.  Use  the
299       first one that exists.
300
301
302       --match-server-version=false
303           Require server version to match client version
304
305
306       --mesos-agent="127.0.0.1:5051"
307           Mesos agent address
308
309
310       --mesos-agent-timeout=10s
311           Mesos agent timeout
312
313
314       -n, --namespace=""
315           If present, the namespace scope for this CLI request
316
317
318       --request-timeout="0"
319           The  length  of  time  to  wait before giving up on a single server
320       request. Non-zero values should contain a corresponding time unit (e.g.
321       1s, 2m, 3h). A value of zero means don't timeout requests.
322
323
324       -s, --server=""
325           The address and port of the Kubernetes API server
326
327
328       --stderrthreshold=2
329           logs at or above this threshold go to stderr
330
331
332       --storage-driver-buffer-duration=1m0s
333           Writes  in  the  storage driver will be buffered for this duration,
334       and committed to the non memory backends as a single transaction
335
336
337       --storage-driver-db="cadvisor"
338           database name
339
340
341       --storage-driver-host="localhost:8086"
342           database host:port
343
344
345       --storage-driver-password="root"
346           database password
347
348
349       --storage-driver-secure=false
350           use secure connection with database
351
352
353       --storage-driver-table="stats"
354           table name
355
356
357       --storage-driver-user="root"
358           database username
359
360
361       --token=""
362           Bearer token for authentication to the API server
363
364
365       --user=""
366           The name of the kubeconfig user to use
367
368
369       -v, --v=0
370           log level for V logs
371
372
373       --version=false
374           Print version information and quit
375
376
377       --vmodule=
378           comma-separated list of pattern=N settings for  file-filtered  log‐
379       ging
380
381
382

EXAMPLE

384                # Update deployment 'registry' with a new environment variable
385                kubectl set env deployment/registry STORAGE_DIR=/local
386
387                # List the environment variables defined on a deployments 'sample-build'
388                kubectl set env deployment/sample-build --list
389
390                # List the environment variables defined on all pods
391                kubectl set env pods --all --list
392
393                # Output modified deployment in YAML, and does not alter the object on the server
394                kubectl set env deployment/sample-build STORAGE_DIR=/data -o yaml
395
396                # Update all containers in all replication controllers in the project to have ENV=prod
397                kubectl set env rc --all ENV=prod
398
399                # Import environment from a secret
400                kubectl set env --from=secret/mysecret deployment/myapp
401
402                # Import environment from a config map with a prefix
403                kubectl set env --from=configmap/myconfigmap --prefix=MYSQL_ deployment/myapp
404
405                # Import specific keys from a config map
406                kubectl set env --keys=my-example-key --from=configmap/myconfigmap deployment/myapp
407
408                # Remove the environment variable ENV from container 'c1' in all deployment configs
409                kubectl set env deployments --all --containers="c1" ENV-
410
411                # Remove the environment variable ENV from a deployment definition on disk and
412                # update the deployment config on the server
413                kubectl set env -f deploy.json ENV-
414
415                # Set some of the local shell environment into a deployment config on the server
416                env | grep RAILS_ | kubectl set env -e - deployment/registry
417
418
419
420

SEE ALSO

422       kubectl-set(1),
423
424
425

HISTORY

427       January  2015,  Originally compiled by Eric Paris (eparis at redhat dot
428       com) based on the kubernetes source material, but hopefully  they  have
429       been automatically generated since!
430
431
432
433Eric Paris                  kubernetes User Manuals              KUBERNETES(1)
Impressum