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

NAME

6       kubectl  run-container  -  Run  a particular image on the cluster. This
7       command is deprecated, use "run" instead
8
9
10

SYNOPSIS

12       kubectl run-container [OPTIONS]
13
14
15

DESCRIPTION

17       Create and run a particular image, possibly replicated.
18
19
20       Creates a deployment or job to manage the created container(s).
21
22
23

OPTIONS

25       --allow-missing-template-keys=true
26           If true, ignore any errors in templates when a field or map key  is
27       missing  in  the  template.  Only applies to golang and jsonpath output
28       formats.
29
30
31       --attach=false
32           If true, wait for the Pod to start running, and then attach to  the
33       Pod  as  if  'kubectl  attach  ...' were called.  Default false, unless
34       '-i/--stdin'  is  set,  in  which  case  the  default  is  true.   With
35       '--restart=Never' the exit code of the container process is returned.
36
37
38       --cascade=true
39           If  true,  cascade  the  deletion  of the resources managed by this
40       resource (e.g. Pods created by a ReplicationController).  Default true.
41
42
43       --command=false
44           If true and extra arguments are present, use them as the  'command'
45       field  in  the  container,  rather  than  the 'args' field which is the
46       default.
47
48
49       --dry-run=false
50           If true, only print the object that would be sent, without  sending
51       it.
52
53
54       --env=[]
55           Environment variables to set in the container
56
57
58       --expose=false
59           If true, a public, external service is created for the container(s)
60       which are run
61
62
63       -f, --filename=[]
64           to use to replace the resource.
65
66
67       --force=false
68           Only  used  when  grace-period=0.  If  true,   immediately   remove
69       resources  from  API  and bypass graceful deletion. Note that immediate
70       deletion of some resources may result in inconsistency or data loss and
71       requires confirmation.
72
73
74       --generator=""
75           The   name   of  the  API  generator  to  use,  see  ⟨http://kuber
76       netes.io/docs/user-guide/kubectl-conventions/#generators⟩ for a list.
77
78
79       --grace-period=-1
80           Period of time in seconds given to the resource to terminate grace‐
81       fully.  Ignored  if negative. Set to 1 for immediate shutdown. Can only
82       be set to 0 when --force is true (force deletion).
83
84
85       --hostport=-1
86           The host port mapping for the container port. To demonstrate a sin‐
87       gle-machine container.
88
89
90       --image=""
91           The image for the container to run.
92
93
94       --image-pull-policy=""
95           The  image pull policy for the container. If left empty, this value
96       will not be specified by the client and defaulted by the server
97
98
99       -l, --labels=""
100           Comma separated labels to apply to the pod(s). Will override previ‐
101       ous values.
102
103
104       --leave-stdin-open=false
105           If  the  pod  is  started  in interactive mode or with stdin, leave
106       stdin open after the first attach completes. By default, stdin will  be
107       closed after the first attach completes.
108
109
110       --limits=""
111           The  resource  requirement limits for this container.  For example,
112       'cpu=200m,memory=512Mi'.  Note that server side components  may  assign
113       limits depending on the server configuration, such as limit ranges.
114
115
116       -o, --output=""
117           Output format. One of: json|yaml|name|templatefile|template|go-tem‐
118       plate|go-template-file|jsonpath|jsonpath-file.
119
120
121       --overrides=""
122           An inline JSON override  for  the  generated  object.  If  this  is
123       non-empty,  it  is used to override the generated object. Requires that
124       the object supply a valid apiVersion field.
125
126
127       --pod-running-timeout=1m0s
128           The length of time (like 5s, 2m, or 3h, higher than zero)  to  wait
129       until at least one pod is running
130
131
132       --port=""
133           The port that this container exposes.  If --expose is true, this is
134       also the port used by the service that is created.
135
136
137       --quiet=false
138           If true, suppress prompt messages.
139
140
141       --record=false
142           Record current kubectl command in the resource annotation.  If  set
143       to  false,  do  not record the command. If set to true, record the com‐
144       mand. If not set, default to updating  the  existing  annotation  value
145       only if one already exists.
146
147
148       -R, --recursive=false
149           Process  the  directory  used in -f, --filename recursively. Useful
150       when you want to manage related manifests  organized  within  the  same
151       directory.
152
153
154       -r, --replicas=1
155           Number of replicas to create for this container. Default is 1.
156
157
158       --requests=""
159           The resource requirement requests for this container.  For example,
160       'cpu=100m,memory=256Mi'.  Note that server side components  may  assign
161       requests depending on the server configuration, such as limit ranges.
162
163
164       --restart="Always"
165           The  restart policy for this Pod.  Legal values [Always, OnFailure,
166       Never].  If set to 'Always' a deployment is created, if set to 'OnFail‐
167       ure' a job is created, if set to 'Never', a regular pod is created. For
168       the latter two --replicas must be 1.  Default  'Always',  for  CronJobs
169       Never.
170
171
172       --rm=false
173           If true, delete resources created in this command for attached con‐
174       tainers.
175
176
177       --save-config=false
178           If true, the configuration of current object will be saved  in  its
179       annotation.  Otherwise,  the annotation will be unchanged. This flag is
180       useful when you want to perform kubectl apply on  this  object  in  the
181       future.
182
183
184       --schedule=""
185           A schedule in the Cron format the job should be run with.
186
187
188       --service-generator="service/v2"
189           The name of the generator to use for creating a service.  Only used
190       if --expose is true
191
192
193       --service-overrides=""
194           An inline JSON override for the generated service object.  If  this
195       is  non-empty,  it  is  used to override the generated object. Requires
196       that the object supply a valid apiVersion field.  Only used if --expose
197       is true.
198
199
200       --serviceaccount=""
201           Service account to set in the pod spec
202
203
204       -i, --stdin=false
205           Keep  stdin open on the container(s) in the pod, even if nothing is
206       attached.
207
208
209       --template=""
210           Template string or path to template file  to  use  when  -o=go-tem‐
211       plate,  -o=go-template-file.  The template format is golang templates [
212http://golang.org/pkg/text/template/#pkg-overview⟩].
213
214
215       --timeout=0s
216           The length of time to wait before giving up on a delete, zero means
217       determine a timeout from the size of the object
218
219
220       -t, --tty=false
221           Allocated a TTY for each container in the pod.
222
223
224       --wait=false
225           If true, wait for resources to be gone before returning. This waits
226       for finalizers.
227
228
229

OPTIONS INHERITED FROM PARENT COMMANDS

231       --allow-verification-with-non-compliant-keys=false
232           Allow  a  SignatureVerifier  to  use  keys  which  are  technically
233       non-compliant with RFC6962.
234
235
236       --alsologtostderr=false
237           log to standard error as well as files
238
239
240       --application-metrics-count-limit=100
241           Max number of application metrics to store (per container)
242
243
244       --as=""
245           Username to impersonate for the operation
246
247
248       --as-group=[]
249           Group  to  impersonate for the operation, this flag can be repeated
250       to specify multiple groups.
251
252
253       --azure-container-registry-config=""
254           Path to the file containing Azure container registry  configuration
255       information.
256
257
258       --boot-id-file="/proc/sys/kernel/random/boot_id"
259           Comma-separated  list  of files to check for boot-id. Use the first
260       one that exists.
261
262
263       --cache-dir="/builddir/.kube/http-cache"
264           Default HTTP cache directory
265
266
267       --certificate-authority=""
268           Path to a cert file for the certificate authority
269
270
271       --client-certificate=""
272           Path to a client certificate file for TLS
273
274
275       --client-key=""
276           Path to a client key file for TLS
277
278
279       --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
280           CIDRs opened in GCE firewall for LB traffic proxy  health checks
281
282
283       --cluster=""
284           The name of the kubeconfig cluster to use
285
286
287       --container-hints="/etc/cadvisor/container_hints.json"
288           location of the container hints file
289
290
291       --containerd="unix:///var/run/containerd.sock"
292           containerd endpoint
293
294
295       --context=""
296           The name of the kubeconfig context to use
297
298
299       --default-not-ready-toleration-seconds=300
300           Indicates    the    tolerationSeconds   of   the   toleration   for
301       notReady:NoExecute that is added by default to every pod that does  not
302       already have such a toleration.
303
304
305       --default-unreachable-toleration-seconds=300
306           Indicates  the  tolerationSeconds  of  the  toleration for unreach‐
307       able:NoExecute that is added by default to  every  pod  that  does  not
308       already have such a toleration.
309
310
311       --docker="unix:///var/run/docker.sock"
312           docker endpoint
313
314
315       --docker-env-metadata-whitelist=""
316           a  comma-separated  list of environment variable keys that needs to
317       be collected for docker containers
318
319
320       --docker-only=false
321           Only report docker containers in addition to root stats
322
323
324       --docker-root="/var/lib/docker"
325           DEPRECATED: docker root is read from docker info (this is  a  fall‐
326       back, default: /var/lib/docker)
327
328
329       --docker-tls=false
330           use TLS to connect to docker
331
332
333       --docker-tls-ca="ca.pem"
334           path to trusted CA
335
336
337       --docker-tls-cert="cert.pem"
338           path to client certificate
339
340
341       --docker-tls-key="key.pem"
342           path to private key
343
344
345       --enable-load-reader=false
346           Whether to enable cpu load reader
347
348
349       --event-storage-age-limit="default=0"
350           Max length of time for which to store events (per type). Value is a
351       comma separated list of key values, where  the  keys  are  event  types
352       (e.g.: creation, oom) or "default" and the value is a duration. Default
353       is applied to all non-specified event types
354
355
356       --event-storage-event-limit="default=0"
357           Max number of events to store (per type). Value is  a  comma  sepa‐
358       rated  list  of  key values, where the keys are event types (e.g.: cre‐
359       ation, oom) or "default" and  the  value  is  an  integer.  Default  is
360       applied to all non-specified event types
361
362
363       --global-housekeeping-interval=1m0s
364           Interval between global housekeepings
365
366
367       --google-json-key=""
368           The  Google  Cloud  Platform  Service  Account  JSON Key to use for
369       authentication.
370
371
372       --housekeeping-interval=10s
373           Interval between container housekeepings
374
375
376       --insecure-skip-tls-verify=false
377           If true, the server's certificate will not be checked for validity.
378       This will make your HTTPS connections insecure
379
380
381       --kubeconfig=""
382           Path to the kubeconfig file to use for CLI requests.
383
384
385       --log-backtrace-at=:0
386           when logging hits line file:N, emit a stack trace
387
388
389       --log-cadvisor-usage=false
390           Whether to log the usage of the cAdvisor container
391
392
393       --log-dir=""
394           If non-empty, write log files in this directory
395
396
397       --log-flush-frequency=5s
398           Maximum number of seconds between log flushes
399
400
401       --logtostderr=true
402           log to standard error instead of files
403
404
405       --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
406           Comma-separated  list  of  files  to  check for machine-id. Use the
407       first one that exists.
408
409
410       --match-server-version=false
411           Require server version to match client version
412
413
414       --mesos-agent="127.0.0.1:5051"
415           Mesos agent address
416
417
418       --mesos-agent-timeout=10s
419           Mesos agent timeout
420
421
422       -n, --namespace=""
423           If present, the namespace scope for this CLI request
424
425
426       --request-timeout="0"
427           The length of time to wait before giving  up  on  a  single  server
428       request. Non-zero values should contain a corresponding time unit (e.g.
429       1s, 2m, 3h). A value of zero means don't timeout requests.
430
431
432       -s, --server=""
433           The address and port of the Kubernetes API server
434
435
436       --stderrthreshold=2
437           logs at or above this threshold go to stderr
438
439
440       --storage-driver-buffer-duration=1m0s
441           Writes in the storage driver will be buffered  for  this  duration,
442       and committed to the non memory backends as a single transaction
443
444
445       --storage-driver-db="cadvisor"
446           database name
447
448
449       --storage-driver-host="localhost:8086"
450           database host:port
451
452
453       --storage-driver-password="root"
454           database password
455
456
457       --storage-driver-secure=false
458           use secure connection with database
459
460
461       --storage-driver-table="stats"
462           table name
463
464
465       --storage-driver-user="root"
466           database username
467
468
469       --token=""
470           Bearer token for authentication to the API server
471
472
473       --user=""
474           The name of the kubeconfig user to use
475
476
477       -v, --v=0
478           log level for V logs
479
480
481       --version=false
482           Print version information and quit
483
484
485       --vmodule=
486           comma-separated  list  of pattern=N settings for file-filtered log‐
487       ging
488
489
490

EXAMPLE

492                # Start a single instance of nginx.
493                kubectl run nginx --image=nginx
494
495                # Start a single instance of hazelcast and let the container expose port 5701 .
496                kubectl run hazelcast --image=hazelcast --port=5701
497
498                # Start a single instance of hazelcast and set environment variables "DNS_DOMAIN=cluster" and "POD_NAMESPACE=default" in the container.
499                kubectl run hazelcast --image=hazelcast --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default"
500
501                # Start a single instance of hazelcast and set labels "app=hazelcast" and "env=prod" in the container.
502                kubectl run hazelcast --image=hazelcast --labels="app=hazelcast,env=prod"
503
504                # Start a replicated instance of nginx.
505                kubectl run nginx --image=nginx --replicas=5
506
507                # Dry run. Print the corresponding API objects without creating them.
508                kubectl run nginx --image=nginx --dry-run
509
510                # Start a single instance of nginx, but overload the spec of the deployment with a partial set of values parsed from JSON.
511                kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
512
513                # Start a pod of busybox and keep it in the foreground, don't restart it if it exits.
514                kubectl run -i -t busybox --image=busybox --restart=Never
515
516                # Start the nginx container using the default command, but use custom arguments (arg1 .. argN) for that command.
517                kubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN>
518
519                # Start the nginx container using a different command and custom arguments.
520                kubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>
521
522                # Start the perl container to compute π to 2000 places and print it out.
523                kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'
524
525                # Start the cron job to compute π to 2000 places and print it out every 5 minutes.
526                kubectl run pi --schedule="0/5 * * * ?" --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'
527
528
529
530

SEE ALSO

532       kubectl(1),
533
534
535

HISTORY

537       January 2015, Originally compiled by Eric Paris (eparis at  redhat  dot
538       com)  based  on the kubernetes source material, but hopefully they have
539       been automatically generated since!
540
541
542
543Eric Paris                  kubernetes User Manuals              KUBERNETES(1)
Impressum