1KUBERNETES(1) Jan 2015 KUBERNETES(1)
2
3
4
6 kubectl create secret generic - Create a secret from a local file,
7 directory or literal value
8
9
10
12 kubectl create secret generic [OPTIONS]
13
14
15
17 Create a secret based on a file, directory, or specified literal value.
18
19
20 A single secret may package one or more key/value pairs.
21
22
23 When creating a secret based on a file, the key will default to the
24 basename of the file, and the value will default to the file content.
25 If the basename is an invalid key or you wish to chose your own, you
26 may specify an alternate key.
27
28
29 When creating a secret based on a directory, each file whose basename
30 is a valid key in the directory will be packaged into the secret. Any
31 directory entries except regular files are ignored (e.g.
32 subdirectories, symlinks, devices, pipes, etc).
33
34
35
37 --allow-missing-template-keys=true
38 If true, ignore any errors in templates when a field or map key is
39 missing in the template. Only applies to golang and jsonpath output
40 formats.
41
42
43 --append-hash=false
44 Append a hash of the secret to its name.
45
46
47 --dry-run="none"
48 Must be "none", "server", or "client". If client strategy, only
49 print the object that would be sent, without sending it. If server
50 strategy, submit server-side request without persisting the resource.
51
52
53 --from-env-file=""
54 Specify the path to a file to read lines of key=val pairs to create
55 a secret (i.e. a Docker .env file).
56
57
58 --from-file=[]
59 Key files can be specified using their file path, in which case a
60 default name will be given to them, or optionally with a name and file
61 path, in which case the given name will be used. Specifying a
62 directory will iterate each named file in the directory that is a valid
63 secret key.
64
65
66 --from-literal=[]
67 Specify a key and literal value to insert in secret (i.e.
68 mykey=somevalue)
69
70
71 --generator="secret/v1"
72 The name of the API generator to use.
73
74
75 -o, --output=""
76 Output format. One of:
77 json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.
78
79
80 --save-config=false
81 If true, the configuration of current object will be saved in its
82 annotation. Otherwise, the annotation will be unchanged. This flag is
83 useful when you want to perform kubectl apply on this object in the
84 future.
85
86
87 --template=""
88 Template string or path to template file to use when
89 -o=go-template, -o=go-template-file. The template format is golang
90 templates [ ⟨http://golang.org/pkg/text/template/#pkg-overview⟩].
91
92
93 --type=""
94 The type of secret to create
95
96
97 --validate=true
98 If true, use a schema to validate the input before sending it
99
100
101
103 --add-dir-header=false
104 If true, adds the file directory to the header
105
106
107 --alsologtostderr=false
108 log to standard error as well as files
109
110
111 --application-metrics-count-limit=100
112 Max number of application metrics to store (per container)
113
114
115 --as=""
116 Username to impersonate for the operation
117
118
119 --as-group=[]
120 Group to impersonate for the operation, this flag can be repeated
121 to specify multiple groups.
122
123
124 --azure-container-registry-config=""
125 Path to the file containing Azure container registry configuration
126 information.
127
128
129 --boot-id-file="/proc/sys/kernel/random/boot_id"
130 Comma-separated list of files to check for boot-id. Use the first
131 one that exists.
132
133
134 --cache-dir="/builddir/.kube/http-cache"
135 Default HTTP cache directory
136
137
138 --certificate-authority=""
139 Path to a cert file for the certificate authority
140
141
142 --client-certificate=""
143 Path to a client certificate file for TLS
144
145
146 --client-key=""
147 Path to a client key file for TLS
148
149
150 --cloud-provider-gce-l7lb-src-cidrs=130.211.0.0/22,35.191.0.0/16
151 CIDRs opened in GCE firewall for L7 LB traffic proxy health checks
152
153
154 --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
155 CIDRs opened in GCE firewall for L4 LB traffic proxy health checks
156
157
158 --cluster=""
159 The name of the kubeconfig cluster to use
160
161
162 --container-hints="/etc/cadvisor/container_hints.json"
163 location of the container hints file
164
165
166 --containerd="/run/containerd/containerd.sock"
167 containerd endpoint
168
169
170 --containerd-namespace="k8s.io"
171 containerd namespace
172
173
174 --context=""
175 The name of the kubeconfig context to use
176
177
178 --default-not-ready-toleration-seconds=300
179 Indicates the tolerationSeconds of the toleration for
180 notReady:NoExecute that is added by default to every pod that does not
181 already have such a toleration.
182
183
184 --default-unreachable-toleration-seconds=300
185 Indicates the tolerationSeconds of the toleration for
186 unreachable:NoExecute that is added by default to every pod that does
187 not already have such a toleration.
188
189
190 --disable-root-cgroup-stats=false
191 Disable collecting root Cgroup stats
192
193
194 --docker="unix:///var/run/docker.sock"
195 docker endpoint
196
197
198 --docker-env-metadata-whitelist=""
199 a comma-separated list of environment variable keys that needs to
200 be collected for docker containers
201
202
203 --docker-only=false
204 Only report docker containers in addition to root stats
205
206
207 --docker-root="/var/lib/docker"
208 DEPRECATED: docker root is read from docker info (this is a
209 fallback, default: /var/lib/docker)
210
211
212 --docker-tls=false
213 use TLS to connect to docker
214
215
216 --docker-tls-ca="ca.pem"
217 path to trusted CA
218
219
220 --docker-tls-cert="cert.pem"
221 path to client certificate
222
223
224 --docker-tls-key="key.pem"
225 path to private key
226
227
228 --enable-load-reader=false
229 Whether to enable cpu load reader
230
231
232 --event-storage-age-limit="default=0"
233 Max length of time for which to store events (per type). Value is a
234 comma separated list of key values, where the keys are event types
235 (e.g.: creation, oom) or "default" and the value is a duration. Default
236 is applied to all non-specified event types
237
238
239 --event-storage-event-limit="default=0"
240 Max number of events to store (per type). Value is a comma
241 separated list of key values, where the keys are event types (e.g.:
242 creation, oom) or "default" and the value is an integer. Default is
243 applied to all non-specified event types
244
245
246 --global-housekeeping-interval=1m0s
247 Interval between global housekeepings
248
249
250 --housekeeping-interval=10s
251 Interval between container housekeepings
252
253
254 --insecure-skip-tls-verify=false
255 If true, the server's certificate will not be checked for validity.
256 This will make your HTTPS connections insecure
257
258
259 --kubeconfig=""
260 Path to the kubeconfig file to use for CLI requests.
261
262
263 --log-backtrace-at=:0
264 when logging hits line file:N, emit a stack trace
265
266
267 --log-cadvisor-usage=false
268 Whether to log the usage of the cAdvisor container
269
270
271 --log-dir=""
272 If non-empty, write log files in this directory
273
274
275 --log-file=""
276 If non-empty, use this log file
277
278
279 --log-file-max-size=1800
280 Defines the maximum size a log file can grow to. Unit is megabytes.
281 If the value is 0, the maximum file size is unlimited.
282
283
284 --log-flush-frequency=5s
285 Maximum number of seconds between log flushes
286
287
288 --logtostderr=true
289 log to standard error instead of files
290
291
292 --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
293 Comma-separated list of files to check for machine-id. Use the
294 first one that exists.
295
296
297 --match-server-version=false
298 Require server version to match client version
299
300
301 -n, --namespace=""
302 If present, the namespace scope for this CLI request
303
304
305 --password=""
306 Password for basic authentication to the API server
307
308
309 --profile="none"
310 Name of profile to capture. One of
311 (none|cpu|heap|goroutine|threadcreate|block|mutex)
312
313
314 --profile-output="profile.pprof"
315 Name of the file to write the profile to
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 --skip-headers=false
329 If true, avoid header prefixes in the log messages
330
331
332 --skip-log-headers=false
333 If true, avoid headers when opening log files
334
335
336 --stderrthreshold=2
337 logs at or above this threshold go to stderr
338
339
340 --storage-driver-buffer-duration=1m0s
341 Writes in the storage driver will be buffered for this duration,
342 and committed to the non memory backends as a single transaction
343
344
345 --storage-driver-db="cadvisor"
346 database name
347
348
349 --storage-driver-host="localhost:8086"
350 database host:port
351
352
353 --storage-driver-password="root"
354 database password
355
356
357 --storage-driver-secure=false
358 use secure connection with database
359
360
361 --storage-driver-table="stats"
362 table name
363
364
365 --storage-driver-user="root"
366 database username
367
368
369 --tls-server-name=""
370 Server name to use for server certificate validation. If it is not
371 provided, the hostname used to contact the server is used
372
373
374 --token=""
375 Bearer token for authentication to the API server
376
377
378 --update-machine-info-interval=5m0s
379 Interval between machine info updates.
380
381
382 --user=""
383 The name of the kubeconfig user to use
384
385
386 --username=""
387 Username for basic authentication to the API server
388
389
390 -v, --v=0
391 number for the log level verbosity
392
393
394 --version=false
395 Print version information and quit
396
397
398 --vmodule=
399 comma-separated list of pattern=N settings for file-filtered
400 logging
401
402
403
405 # Create a new secret named my-secret with keys for each file in folder bar
406 kubectl create secret generic my-secret --from-file=path/to/bar
407
408 # Create a new secret named my-secret with specified keys instead of names on disk
409 kubectl create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-file=ssh-publickey=path/to/id_rsa.pub
410
411 # Create a new secret named my-secret with key1=supersecret and key2=topsecret
412 kubectl create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret
413
414 # Create a new secret named my-secret using a combination of a file and a literal
415 kubectl create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-literal=passphrase=topsecret
416
417 # Create a new secret named my-secret from an env file
418 kubectl create secret generic my-secret --from-env-file=path/to/bar.env
419
420
421
422
424 kubectl-create-secret(1),
425
426
427
429 January 2015, Originally compiled by Eric Paris (eparis at redhat dot
430 com) based on the kubernetes source material, but hopefully they have
431 been automatically generated since!
432
433
434
435Eric Paris kubernetes User Manuals KUBERNETES(1)