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