1KUBERNETES(1)(kubernetes) KUBERNETES(1)(kubernetes)
2
3
4
5Eric Paris Jan 2015
6
7
9 kubectl set env - Update environment variables on a pod template
10
11
12
14 kubectl set env [OPTIONS]
15
16
17
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
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
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 --disable-compression=false If true, opt-out of response compres‐
167 sion for all requests to the server
168
169
170 --insecure-skip-tls-verify=false If true, the server's certificate
171 will not be checked for validity. This will make your HTTPS connections
172 insecure
173
174
175 --kubeconfig="" Path to the kubeconfig file to use for CLI re‐
176 quests.
177
178
179 --match-server-version=false Require server version to match
180 client version
181
182
183 -n, --namespace="" If present, the namespace scope for this CLI
184 request
185
186
187 --password="" Password for basic authentication to the API server
188
189
190 --profile="none" Name of profile to capture. One of
191 (none|cpu|heap|goroutine|threadcreate|block|mutex)
192
193
194 --profile-output="profile.pprof" Name of the file to write the
195 profile to
196
197
198 --request-timeout="0" The length of time to wait before giving up
199 on a single server request. Non-zero values should contain a corre‐
200 sponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't time‐
201 out requests.
202
203
204 -s, --server="" The address and port of the Kubernetes API server
205
206
207 --tls-server-name="" Server name to use for server certificate
208 validation. If it is not provided, the hostname used to contact the
209 server is used
210
211
212 --token="" Bearer token for authentication to the API server
213
214
215 --user="" The name of the kubeconfig user to use
216
217
218 --username="" Username for basic authentication to the API server
219
220
221 --version=false Print version information and quit
222
223
224 --warnings-as-errors=false Treat warnings received from the server
225 as errors and exit with a non-zero exit code
226
227
228
230 # Update deployment 'registry' with a new environment variable
231 kubectl set env deployment/registry STORAGE_DIR=/local
232
233 # List the environment variables defined on a deployments 'sample-build'
234 kubectl set env deployment/sample-build --list
235
236 # List the environment variables defined on all pods
237 kubectl set env pods --all --list
238
239 # Output modified deployment in YAML, and does not alter the object on the server
240 kubectl set env deployment/sample-build STORAGE_DIR=/data -o yaml
241
242 # Update all containers in all replication controllers in the project to have ENV=prod
243 kubectl set env rc --all ENV=prod
244
245 # Import environment from a secret
246 kubectl set env --from=secret/mysecret deployment/myapp
247
248 # Import environment from a config map with a prefix
249 kubectl set env --from=configmap/myconfigmap --prefix=MYSQL_ deployment/myapp
250
251 # Import specific keys from a config map
252 kubectl set env --keys=my-example-key --from=configmap/myconfigmap deployment/myapp
253
254 # Remove the environment variable ENV from container 'c1' in all deployment configs
255 kubectl set env deployments --all --containers="c1" ENV-
256
257 # Remove the environment variable ENV from a deployment definition on disk and
258 # update the deployment config on the server
259 kubectl set env -f deploy.json ENV-
260
261 # Set some of the local shell environment into a deployment config on the server
262 env | grep RAILS_ | kubectl set env -e - deployment/registry
263
264
265
266
268 kubectl-set(1),
269
270
271
273 January 2015, Originally compiled by Eric Paris (eparis at redhat dot
274 com) based on the kubernetes source material, but hopefully they have
275 been automatically generated since!
276
277
278
279Manuals User KUBERNETES(1)(kubernetes)