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), statefulset (sts), cronjob (cj), 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, jsonpath-as-
97       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,  supports
117       '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). Matching objects
118       must satisfy all of the specified label constraints.
119
120
121       --show-managed-fields=false      If true, keep the  managedFields  when
122       printing objects in JSON or YAML format.
123
124
125       --template=""      Template string or path to template file to use when
126       -o=go-template, -o=go-template-file. The template format is golang tem‐
127       plates [http://golang.org/pkg/text/template/#pkg-overview].
128
129
130

OPTIONS INHERITED FROM PARENT COMMANDS

132       --as=""      Username to impersonate for the operation. User could be a
133       regular user or a service account in a namespace.
134
135
136       --as-group=[]      Group to impersonate for the  operation,  this  flag
137       can be repeated to specify multiple groups.
138
139
140       --as-uid=""      UID to impersonate for the operation.
141
142
143       --azure-container-registry-config=""       Path  to the file containing
144       Azure container registry configuration information.
145
146
147       --cache-dir="/builddir/.kube/cache"      Default cache directory
148
149
150       --certificate-authority=""      Path to a cert file for the certificate
151       authority
152
153
154       --client-certificate=""      Path to a client certificate file for TLS
155
156
157       --client-key=""      Path to a client key file for TLS
158
159
160       --cluster=""      The name of the kubeconfig cluster to use
161
162
163       --context=""      The name of the kubeconfig context to use
164
165
166       --insecure-skip-tls-verify=false      If true, the server's certificate
167       will not be checked for validity. This will make your HTTPS connections
168       insecure
169
170
171       --kubeconfig=""       Path  to  the  kubeconfig file to use for CLI re‐
172       quests.
173
174
175       --match-server-version=false       Require  server  version  to   match
176       client version
177
178
179       -n,  --namespace=""       If  present, the namespace scope for this CLI
180       request
181
182
183       --password=""      Password for basic authentication to the API server
184
185
186       --profile="none"        Name   of   profile   to   capture.   One    of
187       (none|cpu|heap|goroutine|threadcreate|block|mutex)
188
189
190       --profile-output="profile.pprof"       Name  of  the  file to write the
191       profile to
192
193
194       --request-timeout="0"      The length of time to wait before giving  up
195       on  a  single  server  request. Non-zero values should contain a corre‐
196       sponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't time‐
197       out requests.
198
199
200       -s, --server=""      The address and port of the Kubernetes API server
201
202
203       --tls-server-name=""       Server  name  to  use for server certificate
204       validation. If it is not provided, the hostname  used  to  contact  the
205       server is used
206
207
208       --token=""      Bearer token for authentication to the API server
209
210
211       --user=""      The name of the kubeconfig user to use
212
213
214       --username=""      Username for basic authentication to the API server
215
216
217       --version=false      Print version information and quit
218
219
220       --warnings-as-errors=false      Treat warnings received from the server
221       as errors and exit with a non-zero exit code
222
223
224

EXAMPLE

226                # Update deployment 'registry' with a new environment variable
227                kubectl set env deployment/registry STORAGE_DIR=/local
228
229                # List the environment variables defined on a deployments 'sample-build'
230                kubectl set env deployment/sample-build --list
231
232                # List the environment variables defined on all pods
233                kubectl set env pods --all --list
234
235                # Output modified deployment in YAML, and does not alter the object on the server
236                kubectl set env deployment/sample-build STORAGE_DIR=/data -o yaml
237
238                # Update all containers in all replication controllers in the project to have ENV=prod
239                kubectl set env rc --all ENV=prod
240
241                # Import environment from a secret
242                kubectl set env --from=secret/mysecret deployment/myapp
243
244                # Import environment from a config map with a prefix
245                kubectl set env --from=configmap/myconfigmap --prefix=MYSQL_ deployment/myapp
246
247                # Import specific keys from a config map
248                kubectl set env --keys=my-example-key --from=configmap/myconfigmap deployment/myapp
249
250                # Remove the environment variable ENV from container 'c1' in all deployment configs
251                kubectl set env deployments --all --containers="c1" ENV-
252
253                # Remove the environment variable ENV from a deployment definition on disk and
254                # update the deployment config on the server
255                kubectl set env -f deploy.json ENV-
256
257                # Set some of the local shell environment into a deployment config on the server
258                env | grep RAILS_ | kubectl set env -e - deployment/registry
259
260
261
262

SEE ALSO

264       kubectl-set(1),
265
266
267

HISTORY

269       January 2015, Originally compiled by Eric Paris (eparis at  redhat  dot
270       com)  based  on the kubernetes source material, but hopefully they have
271       been automatically generated since!
272
273
274
275Manuals                              User            KUBERNETES(1)(kubernetes)
Impressum