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

NAME

6       kubectl create - Create a resource from a file or from stdin.
7
8
9

SYNOPSIS

11       kubectl create [OPTIONS]
12
13
14

DESCRIPTION

16       Create a resource from a file or from stdin.
17
18
19       JSON and YAML formats are accepted.
20
21
22

OPTIONS

24       --allow-missing-template-keys=true
25           If true, ignore any errors in templates when a field or map key is
26       missing in the template. Only applies to golang and jsonpath output
27       formats.
28
29
30       --dry-run="none"
31           Must be "none", "server", or "client". If client strategy, only
32       print the object that would be sent, without sending it. If server
33       strategy, submit server-side request without persisting the resource.
34
35
36       --edit=false
37           Edit the API resource before creating
38
39
40       -f, --filename=[]
41           Filename, directory, or URL to files to use to create the resource
42
43
44       -k, --kustomize=""
45           Process the kustomization directory. This flag can't be used
46       together with -f or -R.
47
48
49       -o, --output=""
50           Output format. One of:
51       json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.
52
53
54       --raw=""
55           Raw URI to POST to the server.  Uses the transport specified by the
56       kubeconfig file.
57
58
59       --record=false
60           Record current kubectl command in the resource annotation. If set
61       to false, do not record the command. If set to true, record the
62       command. If not set, default to updating the existing annotation value
63       only if one already exists.
64
65
66       -R, --recursive=false
67           Process the directory used in -f, --filename recursively. Useful
68       when you want to manage related manifests organized within the same
69       directory.
70
71
72       --save-config=false
73           If true, the configuration of current object will be saved in its
74       annotation. Otherwise, the annotation will be unchanged. This flag is
75       useful when you want to perform kubectl apply on this object in the
76       future.
77
78
79       -l, --selector=""
80           Selector (label query) to filter on, supports '=', '==', and
81       '!='.(e.g. -l key1=value1,key2=value2)
82
83
84       --template=""
85           Template string or path to template file to use when
86       -o=go-template, -o=go-template-file. The template format is golang
87       templates [ ⟨http://golang.org/pkg/text/template/#pkg-overview⟩].
88
89
90       --validate=true
91           If true, use a schema to validate the input before sending it
92
93
94       --windows-line-endings=false
95           Only relevant if --edit=true. Defaults to the line ending native to
96       your platform.
97
98
99

OPTIONS INHERITED FROM PARENT COMMANDS

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

EXAMPLE

403                # Create a pod using the data in pod.json.
404                kubectl create -f ./pod.json
405
406                # Create a pod based on the JSON passed into stdin.
407                cat pod.json | kubectl create -f -
408
409                # Edit the data in docker-registry.yaml in JSON then create the resource using the edited data.
410                kubectl create -f docker-registry.yaml --edit -o json
411
412
413
414

SEE ALSO

416       kubectl(1), kubectl-create-clusterrole(1),
417       kubectl-create-clusterrolebinding(1), kubectl-create-configmap(1),
418       kubectl-create-cronjob(1), kubectl-create-deployment(1),
419       kubectl-create-job(1), kubectl-create-namespace(1),
420       kubectl-create-poddisruptionbudget(1), kubectl-create-priorityclass(1),
421       kubectl-create-quota(1), kubectl-create-role(1),
422       kubectl-create-rolebinding(1), kubectl-create-secret(1),
423       kubectl-create-service(1), kubectl-create-serviceaccount(1),
424
425
426

HISTORY

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