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

NAME

6       kubectl create configmap - Create a configmap from a local file, direc‐
7       tory 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 base‐
30       name is a valid key in the directory will be  packaged  into  the  con‐
31       figmap.   Any  directory entries except regular files are ignored (e.g.
32       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=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 configmap (i.e. a Docker .env file).
55
56
57       --from-file=[]
58           Key file can be specified using its file path, in which  case  file
59       basename  will  be  used as configmap key, or optionally with a key and
60       file path, in which case the given key  will  be  used.   Specifying  a
61       directory  will iterate each named file in the directory whose basename
62       is a valid configmap key.
63
64
65       --from-literal=[]
66           Specify a key and  literal  value  to  insert  in  configmap  (i.e.
67       mykey=somevalue)
68
69
70       --generator="configmap/v1"
71           The name of the API generator to use.
72
73
74       -o, --output=""
75           Output  format. One of: json|yaml|name|template|go-template|go-tem‐
76       plate-file|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  [
89http://golang.org/pkg/text/template/#pkg-overview⟩].
90
91
92       --validate=true
93           If true, use a schema to validate the input before sending it
94
95
96

OPTIONS INHERITED FROM PARENT COMMANDS

98       --allow-verification-with-non-compliant-keys=false
99           Allow  a  SignatureVerifier  to  use  keys  which  are  technically
100       non-compliant with RFC6962.
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-lb-src-cidrs=130.211.0.0/22,209.85.152.0/22,209.85.204.0/22,35.191.0.0/16
147           CIDRs opened in GCE firewall for LB traffic proxy  health checks
148
149
150       --cluster=""
151           The name of the kubeconfig cluster to use
152
153
154       --container-hints="/etc/cadvisor/container_hints.json"
155           location of the container hints file
156
157
158       --containerd="unix:///var/run/containerd.sock"
159           containerd endpoint
160
161
162       --context=""
163           The name of the kubeconfig context to use
164
165
166       --default-not-ready-toleration-seconds=300
167           Indicates   the   tolerationSeconds   of   the    toleration    for
168       notReady:NoExecute  that is added by default to every pod that does not
169       already have such a toleration.
170
171
172       --default-unreachable-toleration-seconds=300
173           Indicates the tolerationSeconds  of  the  toleration  for  unreach‐
174       able:NoExecute  that  is  added  by  default to every pod that does not
175       already have such a toleration.
176
177
178       --docker="unix:///var/run/docker.sock"
179           docker endpoint
180
181
182       --docker-env-metadata-whitelist=""
183           a comma-separated list of environment variable keys that  needs  to
184       be collected for docker containers
185
186
187       --docker-only=false
188           Only report docker containers in addition to root stats
189
190
191       --docker-root="/var/lib/docker"
192           DEPRECATED:  docker  root is read from docker info (this is a fall‐
193       back, default: /var/lib/docker)
194
195
196       --docker-tls=false
197           use TLS to connect to docker
198
199
200       --docker-tls-ca="ca.pem"
201           path to trusted CA
202
203
204       --docker-tls-cert="cert.pem"
205           path to client certificate
206
207
208       --docker-tls-key="key.pem"
209           path to private key
210
211
212       --enable-load-reader=false
213           Whether to enable cpu load reader
214
215
216       --event-storage-age-limit="default=0"
217           Max length of time for which to store events (per type). Value is a
218       comma  separated  list  of  key  values, where the keys are event types
219       (e.g.: creation, oom) or "default" and the value is a duration. Default
220       is applied to all non-specified event types
221
222
223       --event-storage-event-limit="default=0"
224           Max  number  of  events to store (per type). Value is a comma sepa‐
225       rated list of key values, where the keys are event  types  (e.g.:  cre‐
226       ation,  oom)  or  "default"  and  the  value  is an integer. Default is
227       applied to all non-specified event types
228
229
230       --global-housekeeping-interval=1m0s
231           Interval between global housekeepings
232
233
234       --google-json-key=""
235           The Google Cloud Platform Service  Account  JSON  Key  to  use  for
236       authentication.
237
238
239       --housekeeping-interval=10s
240           Interval between container housekeepings
241
242
243       --insecure-skip-tls-verify=false
244           If true, the server's certificate will not be checked for validity.
245       This will make your HTTPS connections insecure
246
247
248       --kubeconfig=""
249           Path to the kubeconfig file to use for CLI requests.
250
251
252       --log-backtrace-at=:0
253           when logging hits line file:N, emit a stack trace
254
255
256       --log-cadvisor-usage=false
257           Whether to log the usage of the cAdvisor container
258
259
260       --log-dir=""
261           If non-empty, write log files in this directory
262
263
264       --log-flush-frequency=5s
265           Maximum number of seconds between log flushes
266
267
268       --logtostderr=true
269           log to standard error instead of files
270
271
272       --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
273           Comma-separated list of files to  check  for  machine-id.  Use  the
274       first one that exists.
275
276
277       --match-server-version=false
278           Require server version to match client version
279
280
281       --mesos-agent="127.0.0.1:5051"
282           Mesos agent address
283
284
285       --mesos-agent-timeout=10s
286           Mesos agent timeout
287
288
289       -n, --namespace=""
290           If present, the namespace scope for this CLI request
291
292
293       --request-timeout="0"
294           The  length  of  time  to  wait before giving up on a single server
295       request. Non-zero values should contain a corresponding time unit (e.g.
296       1s, 2m, 3h). A value of zero means don't timeout requests.
297
298
299       -s, --server=""
300           The address and port of the Kubernetes API server
301
302
303       --stderrthreshold=2
304           logs at or above this threshold go to stderr
305
306
307       --storage-driver-buffer-duration=1m0s
308           Writes  in  the  storage driver will be buffered for this duration,
309       and committed to the non memory backends as a single transaction
310
311
312       --storage-driver-db="cadvisor"
313           database name
314
315
316       --storage-driver-host="localhost:8086"
317           database host:port
318
319
320       --storage-driver-password="root"
321           database password
322
323
324       --storage-driver-secure=false
325           use secure connection with database
326
327
328       --storage-driver-table="stats"
329           table name
330
331
332       --storage-driver-user="root"
333           database username
334
335
336       --token=""
337           Bearer token for authentication to the API server
338
339
340       --user=""
341           The name of the kubeconfig user to use
342
343
344       -v, --v=0
345           log level for V logs
346
347
348       --version=false
349           Print version information and quit
350
351
352       --vmodule=
353           comma-separated list of pattern=N settings for  file-filtered  log‐
354       ging
355
356
357

EXAMPLE

359                # Create a new configmap named my-config based on folder bar
360                kubectl create configmap my-config --from-file=path/to/bar
361
362                # Create a new configmap named my-config with specified keys instead of file basenames on disk
363                kubectl create configmap my-config --from-file=key1=/path/to/bar/file1.txt --from-file=key2=/path/to/bar/file2.txt
364
365                # Create a new configmap named my-config with key1=config1 and key2=config2
366                kubectl create configmap my-config --from-literal=key1=config1 --from-literal=key2=config2
367
368                # Create a new configmap named my-config from the key=value pairs in the file
369                kubectl create configmap my-config --from-file=path/to/bar
370
371                # Create a new configmap named my-config from an env file
372                kubectl create configmap my-config --from-env-file=path/to/bar.env
373
374
375
376

SEE ALSO

378       kubectl-create(1),
379
380
381

HISTORY

383       January  2015,  Originally compiled by Eric Paris (eparis at redhat dot
384       com) based on the kubernetes source material, but hopefully  they  have
385       been automatically generated since!
386
387
388
389Eric Paris                  kubernetes User Manuals              KUBERNETES(1)
Impressum