1KUBERNETES(1)                      Jan 2015                      KUBERNETES(1)
2
3
4

NAME

6       kubectl create configmap - Create a configmap from a local file,
7       directory or literal value
8
9
10

SYNOPSIS

12       kubectl create configmap [OPTIONS]
13
14
15

DESCRIPTION

17       Create a configmap based on a file, directory, or specified literal
18       value.
19
20
21       A single configmap may package one or more key/value pairs.
22
23
24       When creating a configmap based on a file, the key will default to the
25       basename of the file, and the value will default to the file content.
26       If the basename is an invalid key, you may specify an alternate key.
27
28
29       When creating a configmap based on a directory, each file whose
30       basename is a valid key in the directory will be packaged into the
31       configmap.  Any directory entries except regular files are ignored
32       (e.g. subdirectories, symlinks, devices, pipes, etc).
33
34
35

OPTIONS

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 configmap 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 configmap (i.e. a Docker .env file).
56
57
58       --from-file=[]
59           Key file can be specified using its file path, in which case file
60       basename will be used as configmap key, or optionally with a key and
61       file path, in which case the given key will be used.  Specifying a
62       directory will iterate each named file in the directory whose basename
63       is a valid configmap key.
64
65
66       --from-literal=[]
67           Specify a key and literal value to insert in configmap (i.e.
68       mykey=somevalue)
69
70
71       --generator="configmap/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       --validate=true
94           If true, use a schema to validate the input before sending it
95
96
97

OPTIONS INHERITED FROM PARENT COMMANDS

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

EXAMPLE

401                # Create a new configmap named my-config based on folder bar
402                kubectl create configmap my-config --from-file=path/to/bar
403
404                # Create a new configmap named my-config with specified keys instead of file basenames on disk
405                kubectl create configmap my-config --from-file=key1=/path/to/bar/file1.txt --from-file=key2=/path/to/bar/file2.txt
406
407                # Create a new configmap named my-config with key1=config1 and key2=config2
408                kubectl create configmap my-config --from-literal=key1=config1 --from-literal=key2=config2
409
410                # Create a new configmap named my-config from the key=value pairs in the file
411                kubectl create configmap my-config --from-file=path/to/bar
412
413                # Create a new configmap named my-config from an env file
414                kubectl create configmap my-config --from-env-file=path/to/bar.env
415
416
417
418

SEE ALSO

420       kubectl-create(1),
421
422
423

HISTORY

425       January 2015, Originally compiled by Eric Paris (eparis at redhat dot
426       com) based on the kubernetes source material, but hopefully they have
427       been automatically generated since!
428
429
430
431Eric Paris                  kubernetes User Manuals              KUBERNETES(1)
Impressum