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
20       templates. Add, update, or remove container environment variable
21       definitions in one or more pod templates (within replication
22       controllers or deployment configurations). View or modify the
23       environment variable definitions on all containers in the specified
24       pods or pod templates, 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="none"
57           Must be "none", "server", or "client". If client strategy, only
58       print the object that would be sent, without sending it. If server
59       strategy, submit server-side request without persisting the resource.
60
61
62       -e, --env=[]
63           Specify a key-value pair for an environment variable to set into
64       each container.
65
66
67       -f, --filename=[]
68           Filename, directory, or URL to files the resource to update the env
69
70
71       --from=""
72           The name of a resource from which to inject environment variables
73
74
75       --keys=[]
76           Comma-separated list of keys to import from specified resource
77
78
79       -k, --kustomize=""
80           Process the kustomization directory. This flag can't be used
81       together with -f or -R.
82
83
84       --list=false
85           If true, display the environment and any changes in the standard
86       format. this flag will removed when we have kubectl view env.
87
88
89       --local=false
90           If true, set env will NOT contact api-server but run locally.
91
92
93       -o, --output=""
94           Output format. One of:
95       json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.
96
97
98       --overwrite=true
99           If true, allow environment to be overwritten, otherwise reject
100       updates that overwrite existing environment.
101
102
103       --prefix=""
104           Prefix to append to variable names
105
106
107       -R, --recursive=false
108           Process the directory used in -f, --filename recursively. Useful
109       when you want to manage related manifests organized within the same
110       directory.
111
112
113       --resolve=false
114           If true, show secret or configmap references when listing variables
115
116
117       -l, --selector=""
118           Selector (label query) to filter on
119
120
121       --template=""
122           Template string or path to template file to use when
123       -o=go-template, -o=go-template-file. The template format is golang
124       templates [ ⟨http://golang.org/pkg/text/template/#pkg-overview⟩].
125
126
127

OPTIONS INHERITED FROM PARENT COMMANDS

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

EXAMPLE

431                # Update deployment 'registry' with a new environment variable
432                kubectl set env deployment/registry STORAGE_DIR=/local
433
434                # List the environment variables defined on a deployments 'sample-build'
435                kubectl set env deployment/sample-build --list
436
437                # List the environment variables defined on all pods
438                kubectl set env pods --all --list
439
440                # Output modified deployment in YAML, and does not alter the object on the server
441                kubectl set env deployment/sample-build STORAGE_DIR=/data -o yaml
442
443                # Update all containers in all replication controllers in the project to have ENV=prod
444                kubectl set env rc --all ENV=prod
445
446                # Import environment from a secret
447                kubectl set env --from=secret/mysecret deployment/myapp
448
449                # Import environment from a config map with a prefix
450                kubectl set env --from=configmap/myconfigmap --prefix=MYSQL_ deployment/myapp
451
452                # Import specific keys from a config map
453                kubectl set env --keys=my-example-key --from=configmap/myconfigmap deployment/myapp
454
455                # Remove the environment variable ENV from container 'c1' in all deployment configs
456                kubectl set env deployments --all --containers="c1" ENV-
457
458                # Remove the environment variable ENV from a deployment definition on disk and
459                # update the deployment config on the server
460                kubectl set env -f deploy.json ENV-
461
462                # Set some of the local shell environment into a deployment config on the server
463                env | grep RAILS_ | kubectl set env -e - deployment/registry
464
465
466
467

SEE ALSO

469       kubectl-set(1),
470
471
472

HISTORY

474       January 2015, Originally compiled by Eric Paris (eparis at redhat dot
475       com) based on the kubernetes source material, but hopefully they have
476       been automatically generated since!
477
478
479
480Eric Paris                  kubernetes User Manuals              KUBERNETES(1)
Impressum