1KUBERNETES(1)(kubernetes) KUBERNETES(1)(kubernetes)
2
3
4
5Eric Paris Jan 2015
6
7
9 kubectl create - Create a resource from a file or from stdin
10
11
12
14 kubectl create [OPTIONS]
15
16
17
19 Create a resource from a file or from stdin.
20
21
22 JSON and YAML formats are accepted.
23
24
25
27 --allow-missing-template-keys=true If true, ignore any errors in
28 templates when a field or map key is missing in the template. Only ap‐
29 plies to golang and jsonpath output formats.
30
31
32 --dry-run="none" Must be "none", "server", or "client". If client
33 strategy, only print the object that would be sent, without sending it.
34 If server strategy, submit server-side request without persisting the
35 resource.
36
37
38 --edit=false Edit the API resource before creating
39
40
41 --field-manager="kubectl-create" Name of the manager used to track
42 field ownership.
43
44
45 -f, --filename=[] Filename, directory, or URL to files to use to
46 create the resource
47
48
49 -k, --kustomize="" Process the kustomization directory. This flag
50 can't be used together with -f or -R.
51
52
53 -o, --output="" Output format. One of: (json, yaml, name, go-tem‐
54 plate, go-template-file, template, templatefile, jsonpath, jsonpath-as-
55 json, jsonpath-file).
56
57
58 --raw="" Raw URI to POST to the server. Uses the transport speci‐
59 fied by the kubeconfig file.
60
61
62 --record=false Record current kubectl command in the resource an‐
63 notation. If set to false, do not record the command. If set to true,
64 record the command. If not set, default to updating the existing anno‐
65 tation value only if one already exists.
66
67
68 -R, --recursive=false Process the directory used in -f, --filename
69 recursively. Useful when you want to manage related manifests organized
70 within the same directory.
71
72
73 --save-config=false If true, the configuration of current object
74 will be saved in its annotation. Otherwise, the annotation will be un‐
75 changed. This flag is useful when you want to perform kubectl apply on
76 this object in the future.
77
78
79 -l, --selector="" Selector (label query) to filter on, supports
80 '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). Matching objects
81 must satisfy all of the specified label constraints.
82
83
84 --show-managed-fields=false If true, keep the managedFields when
85 printing objects in JSON or YAML format.
86
87
88 --template="" Template string or path to template file to use when
89 -o=go-template, -o=go-template-file. The template format is golang tem‐
90 plates [http://golang.org/pkg/text/template/#pkg-overview].
91
92
93 --validate="strict" Must be one of: strict (or true), warn, ignore
94 (or false). "true" or "strict" will use a schema to validate
95 the input and fail the request if invalid. It will perform server side
96 validation if ServerSideFieldValidation is enabled on the api-server,
97 but will fall back to less reliable client-side validation if not.
98 "warn" will warn about unknown or duplicate fields without
99 blocking the request if server-side field validation is enabled on the
100 API server, and behave as "ignore" otherwise. "false" or
101 "ignore" will not perform any schema validation, silently dropping any
102 unknown or duplicate fields.
103
104
105 --windows-line-endings=false Only relevant if --edit=true. De‐
106 faults to the line ending native to your platform.
107
108
109
111 --as="" Username to impersonate for the operation. User could be a
112 regular user or a service account in a namespace.
113
114
115 --as-group=[] Group to impersonate for the operation, this flag
116 can be repeated to specify multiple groups.
117
118
119 --as-uid="" UID to impersonate for the operation.
120
121
122 --azure-container-registry-config="" Path to the file containing
123 Azure container registry configuration information.
124
125
126 --cache-dir="/builddir/.kube/cache" Default cache directory
127
128
129 --certificate-authority="" Path to a cert file for the certificate
130 authority
131
132
133 --client-certificate="" Path to a client certificate file for TLS
134
135
136 --client-key="" Path to a client key file for TLS
137
138
139 --cluster="" The name of the kubeconfig cluster to use
140
141
142 --context="" The name of the kubeconfig context to use
143
144
145 --disable-compression=false If true, opt-out of response compres‐
146 sion for all requests to the server
147
148
149 --insecure-skip-tls-verify=false If true, the server's certificate
150 will not be checked for validity. This will make your HTTPS connections
151 insecure
152
153
154 --kubeconfig="" Path to the kubeconfig file to use for CLI re‐
155 quests.
156
157
158 --match-server-version=false Require server version to match
159 client version
160
161
162 -n, --namespace="" If present, the namespace scope for this CLI
163 request
164
165
166 --password="" Password for basic authentication to the API server
167
168
169 --profile="none" Name of profile to capture. One of
170 (none|cpu|heap|goroutine|threadcreate|block|mutex)
171
172
173 --profile-output="profile.pprof" Name of the file to write the
174 profile to
175
176
177 --request-timeout="0" The length of time to wait before giving up
178 on a single server request. Non-zero values should contain a corre‐
179 sponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't time‐
180 out requests.
181
182
183 -s, --server="" The address and port of the Kubernetes API server
184
185
186 --tls-server-name="" Server name to use for server certificate
187 validation. If it is not provided, the hostname used to contact the
188 server is used
189
190
191 --token="" Bearer token for authentication to the API server
192
193
194 --user="" The name of the kubeconfig user to use
195
196
197 --username="" Username for basic authentication to the API server
198
199
200 --version=false Print version information and quit
201
202
203 --warnings-as-errors=false Treat warnings received from the server
204 as errors and exit with a non-zero exit code
205
206
207
209 # Create a pod using the data in pod.json
210 kubectl create -f ./pod.json
211
212 # Create a pod based on the JSON passed into stdin
213 cat pod.json | kubectl create -f -
214
215 # Edit the data in registry.yaml in JSON then create the resource using the edited data
216 kubectl create -f registry.yaml --edit -o json
217
218
219
220
222 kubectl(1), kubectl-create-clusterrole(1), kubectl-create-cluster‐
223 rolebinding(1), kubectl-create-configmap(1), kubectl-create-cronjob(1),
224 kubectl-create-deployment(1), kubectl-create-ingress(1), kubectl-cre‐
225 ate-job(1), kubectl-create-namespace(1), kubectl-create-poddisruption‐
226 budget(1), kubectl-create-priorityclass(1), kubectl-create-quota(1),
227 kubectl-create-role(1), kubectl-create-rolebinding(1), kubectl-create-
228 secret(1), kubectl-create-service(1), kubectl-create-serviceaccount(1),
229 kubectl-create-token(1),
230
231
232
234 January 2015, Originally compiled by Eric Paris (eparis at redhat dot
235 com) based on the kubernetes source material, but hopefully they have
236 been automatically generated since!
237
238
239
240Manuals User KUBERNETES(1)(kubernetes)