1OC(1) June 2016 OC(1)
2
3
4
6 oc run - Run a particular image on the cluster
7
8
9
11 oc run [OPTIONS]
12
13
14
16 Create and run a particular image, possibly replicated
17
18
19 Creates a deployment config to manage the created container(s). You can
20 choose to run in the foreground for an interactive container execution.
21 You may pass 'run/v1' to --generator to create a replication controller
22 instead of a deployment config.
23
24
25
27 --allow-missing-template-keys=true
28 If true, ignore any errors in templates when a field or map key is
29 missing in the template. Only applies to golang and jsonpath output
30 formats.
31
32
33 --attach=false
34 If true, wait for the Pod to start running, and then attach to the
35 Pod as if 'kubectl attach ...' were called. Default false, unless
36 '-i/--stdin' is set, in which case the default is true. With
37 '--restart=Never' the exit code of the container process is returned.
38
39
40 --cascade=true
41 If true, cascade the deletion of the resources managed by this
42 resource (e.g. Pods created by a ReplicationController). Default true.
43
44
45 --command=false
46 If true and extra arguments are present, use them as the 'command'
47 field in the container, rather than the 'args' field which is the
48 default.
49
50
51 --dry-run=false
52 If true, only print the object that would be sent, without sending
53 it.
54
55
56 --env=[]
57 Environment variables to set in the container
58
59
60 --expose=false
61 If true, a public, external service is created for the container(s)
62 which are run
63
64
65 -f, --filename=[]
66 to use to replace the resource.
67
68
69 --force=false
70 Only used when grace-period=0. If true, immediately remove
71 resources from API and bypass graceful deletion. Note that immediate
72 deletion of some resources may result in inconsistency or data loss and
73 requires confirmation.
74
75
76 --generator=""
77 The name of the API generator to use. Default is 'deploymentcon‐
78 fig/v1' if --restart=Always, otherwise the default is 'run-pod/v1'.
79
80
81 --grace-period=-1
82 Period of time in seconds given to the resource to terminate grace‐
83 fully. Ignored if negative. Set to 1 for immediate shutdown. Can only
84 be set to 0 when --force is true (force deletion).
85
86
87 --hostport=-1
88 The host port mapping for the container port. To demonstrate a sin‐
89 gle-machine container.
90
91
92 --image=""
93 The image for the container to run.
94
95
96 --image-pull-policy=""
97 The image pull policy for the container. If left empty, this value
98 will not be specified by the client and defaulted by the server
99
100
101 -l, --labels=""
102 Comma separated labels to apply to the pod(s). Will override previ‐
103 ous values.
104
105
106 --leave-stdin-open=false
107 If the pod is started in interactive mode or with stdin, leave
108 stdin open after the first attach completes. By default, stdin will be
109 closed after the first attach completes.
110
111
112 --limits=""
113 The resource requirement limits for this container. For example,
114 'cpu=200m,memory=512Mi'. Note that server side components may assign
115 limits depending on the server configuration, such as limit ranges.
116
117
118 -o, --output=""
119 Output format. One of: json|yaml|name|templatefile|template|go-tem‐
120 plate|go-template-file|jsonpath|jsonpath-file.
121
122
123 --overrides=""
124 An inline JSON override for the generated object. If this is
125 non-empty, it is used to override the generated object. Requires that
126 the object supply a valid apiVersion field.
127
128
129 --pod-running-timeout=0
130 The length of time (like 5s, 2m, or 3h, higher than zero) to wait
131 until at least one pod is running
132
133
134 --port=""
135 The port that this container exposes. If --expose is true, this is
136 also the port used by the service that is created.
137
138
139 --quiet=false
140 If true, suppress prompt messages.
141
142
143 --record=false
144 Record current kubectl command in the resource annotation. If set
145 to false, do not record the command. If set to true, record the com‐
146 mand. If not set, default to updating the existing annotation value
147 only if one already exists.
148
149
150 -R, --recursive=false
151 Process the directory used in -f, --filename recursively. Useful
152 when you want to manage related manifests organized within the same
153 directory.
154
155
156 -r, --replicas=1
157 Number of replicas to create for this container. Default is 1.
158
159
160 --requests=""
161 The resource requirement requests for this container. For example,
162 'cpu=100m,memory=256Mi'. Note that server side components may assign
163 requests depending on the server configuration, such as limit ranges.
164
165
166 --restart="Always"
167 The restart policy for this Pod. Legal values [Always, OnFailure,
168 Never]. If set to 'Always' a deployment is created, if set to 'OnFail‐
169 ure' a job is created, if set to 'Never', a regular pod is created. For
170 the latter two --replicas must be 1. Default 'Always', for CronJobs
171 Never.
172
173
174 --rm=false
175 If true, delete resources created in this command for attached con‐
176 tainers.
177
178
179 --save-config=false
180 If true, the configuration of current object will be saved in its
181 annotation. Otherwise, the annotation will be unchanged. This flag is
182 useful when you want to perform kubectl apply on this object in the
183 future.
184
185
186 --schedule=""
187 A schedule in the Cron format the job should be run with.
188
189
190 --service-generator="service/v2"
191 The name of the generator to use for creating a service. Only used
192 if --expose is true
193
194
195 --service-overrides=""
196 An inline JSON override for the generated service object. If this
197 is non-empty, it is used to override the generated object. Requires
198 that the object supply a valid apiVersion field. Only used if --expose
199 is true.
200
201
202 --serviceaccount=""
203 Service account to set in the pod spec
204
205
206 -i, --stdin=false
207 Keep stdin open on the container(s) in the pod, even if nothing is
208 attached.
209
210
211 --template=""
212 Template string or path to template file to use when -o=go-tem‐
213 plate, -o=go-template-file. The template format is golang templates [
214 ⟨http://golang.org/pkg/text/template/#pkg-overview⟩].
215
216
217 --timeout=0
218 The length of time to wait before giving up on a delete, zero means
219 determine a timeout from the size of the object
220
221
222 -t, --tty=false
223 Allocated a TTY for each container in the pod.
224
225
226 --wait=false
227 If true, wait for resources to be gone before returning. This waits
228 for finalizers.
229
230
231
233 --allow_verification_with_non_compliant_keys=false
234 Allow a SignatureVerifier to use keys which are technically
235 non-compliant with RFC6962.
236
237
238 --alsologtostderr=false
239 log to standard error as well as files
240
241
242 --application_metrics_count_limit=100
243 Max number of application metrics to store (per container)
244
245
246 --as=""
247 Username to impersonate for the operation
248
249
250 --as-group=[]
251 Group to impersonate for the operation, this flag can be repeated
252 to specify multiple groups.
253
254
255 --azure-container-registry-config=""
256 Path to the file containing Azure container registry configuration
257 information.
258
259
260 --boot_id_file="/proc/sys/kernel/random/boot_id"
261 Comma-separated list of files to check for boot-id. Use the first
262 one that exists.
263
264
265 --cache-dir="/builddir/.kube/http-cache"
266 Default HTTP cache directory
267
268
269 --certificate-authority=""
270 Path to a cert file for the certificate authority
271
272
273 --client-certificate=""
274 Path to a client certificate file for TLS
275
276
277 --client-key=""
278 Path to a client key file for TLS
279
280
281 --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
282 CIDRs opened in GCE firewall for LB traffic proxy health checks
283
284
285 --cluster=""
286 The name of the kubeconfig cluster to use
287
288
289 --container_hints="/etc/cadvisor/container_hints.json"
290 location of the container hints file
291
292
293 --containerd="unix:///var/run/containerd.sock"
294 containerd endpoint
295
296
297 --context=""
298 The name of the kubeconfig context to use
299
300
301 --default-not-ready-toleration-seconds=300
302 Indicates the tolerationSeconds of the toleration for
303 notReady:NoExecute that is added by default to every pod that does not
304 already have such a toleration.
305
306
307 --default-unreachable-toleration-seconds=300
308 Indicates the tolerationSeconds of the toleration for unreach‐
309 able:NoExecute that is added by default to every pod that does not
310 already have such a toleration.
311
312
313 --docker="unix:///var/run/docker.sock"
314 docker endpoint
315
316
317 --docker-tls=false
318 use TLS to connect to docker
319
320
321 --docker-tls-ca="ca.pem"
322 path to trusted CA
323
324
325 --docker-tls-cert="cert.pem"
326 path to client certificate
327
328
329 --docker-tls-key="key.pem"
330 path to private key
331
332
333 --docker_env_metadata_whitelist=""
334 a comma-separated list of environment variable keys that needs to
335 be collected for docker containers
336
337
338 --docker_only=false
339 Only report docker containers in addition to root stats
340
341
342 --docker_root="/var/lib/docker"
343 DEPRECATED: docker root is read from docker info (this is a fall‐
344 back, default: /var/lib/docker)
345
346
347 --enable_load_reader=false
348 Whether to enable cpu load reader
349
350
351 --event_storage_age_limit="default=24h"
352 Max length of time for which to store events (per type). Value is a
353 comma separated list of key values, where the keys are event types
354 (e.g.: creation, oom) or "default" and the value is a duration. Default
355 is applied to all non-specified event types
356
357
358 --event_storage_event_limit="default=100000"
359 Max number of events to store (per type). Value is a comma sepa‐
360 rated list of key values, where the keys are event types (e.g.: cre‐
361 ation, oom) or "default" and the value is an integer. Default is
362 applied to all non-specified event types
363
364
365 --global_housekeeping_interval=0
366 Interval between global housekeepings
367
368
369 --housekeeping_interval=0
370 Interval between container housekeepings
371
372
373 --httptest.serve=""
374 if non-empty, httptest.NewServer serves on this address and blocks
375
376
377 --insecure-skip-tls-verify=false
378 If true, the server's certificate will not be checked for validity.
379 This will make your HTTPS connections insecure
380
381
382 --kubeconfig=""
383 Path to the kubeconfig file to use for CLI requests.
384
385
386 --log-flush-frequency=0
387 Maximum number of seconds between log flushes
388
389
390 --log_backtrace_at=:0
391 when logging hits line file:N, emit a stack trace
392
393
394 --log_cadvisor_usage=false
395 Whether to log the usage of the cAdvisor container
396
397
398 --log_dir=""
399 If non-empty, write log files in this directory
400
401
402 --logtostderr=true
403 log to standard error instead of files
404
405
406 --machine_id_file="/etc/machine-id,/var/lib/dbus/machine-id"
407 Comma-separated list of files to check for machine-id. Use the
408 first one that exists.
409
410
411 --match-server-version=false
412 Require server version to match client version
413
414
415 -n, --namespace=""
416 If present, the namespace scope for this CLI request
417
418
419 --request-timeout="0"
420 The length of time to wait before giving up on a single server
421 request. Non-zero values should contain a corresponding time unit (e.g.
422 1s, 2m, 3h). A value of zero means don't timeout requests.
423
424
425 -s, --server=""
426 The address and port of the Kubernetes API server
427
428
429 --stderrthreshold=2
430 logs at or above this threshold go to stderr
431
432
433 --storage_driver_buffer_duration=0
434 Writes in the storage driver will be buffered for this duration,
435 and committed to the non memory backends as a single transaction
436
437
438 --storage_driver_db="cadvisor"
439 database name
440
441
442 --storage_driver_host="localhost:8086"
443 database host:port
444
445
446 --storage_driver_password="root"
447 database password
448
449
450 --storage_driver_secure=false
451 use secure connection with database
452
453
454 --storage_driver_table="stats"
455 table name
456
457
458 --storage_driver_user="root"
459 database username
460
461
462 --token=""
463 Bearer token for authentication to the API server
464
465
466 --user=""
467 The name of the kubeconfig user to use
468
469
470 -v, --v=0
471 log level for V logs
472
473
474 --version=false
475 Print version information and quit
476
477
478 --vmodule=
479 comma-separated list of pattern=N settings for file-filtered log‐
480 ging
481
482
483
485 # Start a single instance of nginx.
486 oc run nginx --image=nginx
487
488 # Start a single instance of hazelcast and let the container expose port 5701 .
489 oc run hazelcast --image=hazelcast --port=5701
490
491 # Start a single instance of hazelcast and set environment variables "DNS_DOMAIN=cluster"
492 # and "POD_NAMESPACE=default" in the container.
493 oc run hazelcast --image=hazelcast --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default"
494
495 # Start a replicated instance of nginx.
496 oc run nginx --image=nginx --replicas=5
497
498 # Dry run. Print the corresponding API objects without creating them.
499 oc run nginx --image=nginx --dry-run
500
501 # Start a single instance of nginx, but overload the spec of the deployment config with
502 # a partial set of values parsed from JSON.
503 oc run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
504
505 # Start a pod of busybox and keep it in the foreground, don't restart it if it exits.
506 oc run -i -t busybox --image=busybox --restart=Never
507
508 # Start the nginx container using the default command, but use custom arguments (arg1 .. argN)
509 # for that command.
510 oc run nginx --image=nginx -- <arg1> <arg2> ... <argN>
511
512 # Start the nginx container using a different command and custom arguments.
513 oc run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>
514
515 # Start the job to compute π to 2000 places and print it out.
516 oc run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'
517
518 # Start the cron job to compute π to 2000 places and print it out every 5 minutes.
519 oc run pi --schedule="0/5 * * * ?" --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'
520
521
522
523
525 oc(1),
526
527
528
530 June 2016, Ported from the Kubernetes man-doc generator
531
532
533
534Openshift Openshift CLI User Manuals OC(1)