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