mirror of https://github.com/k3s-io/k3s
196 lines
8.9 KiB
YAML
196 lines
8.9 KiB
YAML
![]() |
name: run
|
||
|
synopsis: Run a particular image on the cluster.
|
||
|
description: |-
|
||
|
Create and run a particular image, possibly replicated.
|
||
|
Creates a deployment or job to manage the created container(s).
|
||
|
options:
|
||
|
- name: attach
|
||
|
default_value: "false"
|
||
|
usage: |
|
||
|
If true, wait for the Pod to start running, and then attach to the Pod as if 'kubectl attach ...' were called. Default false, unless '-i/--interactive' is set, in which case the default is true.
|
||
|
- name: command
|
||
|
default_value: "false"
|
||
|
usage: |
|
||
|
If true and extra arguments are present, use them as the 'command' field in the container, rather than the 'args' field which is the default.
|
||
|
- name: dry-run
|
||
|
default_value: "false"
|
||
|
usage: |
|
||
|
If true, only print the object that would be sent, without sending it.
|
||
|
- name: env
|
||
|
default_value: '[]'
|
||
|
usage: Environment variables to set in the container
|
||
|
- name: expose
|
||
|
default_value: "false"
|
||
|
usage: |
|
||
|
If true, a public, external service is created for the container(s) which are run
|
||
|
- name: generator
|
||
|
usage: |
|
||
|
The name of the API generator to use. Default is 'deployment/v1beta1' if --restart=Always, otherwise the default is 'job/v1'. This will happen only for cluster version at least 1.2, for olders we will fallback to 'run/v1' for --restart=Always, 'run-pod/v1' for others.
|
||
|
- name: hostport
|
||
|
default_value: "-1"
|
||
|
usage: |
|
||
|
The host port mapping for the container port. To demonstrate a single-machine container.
|
||
|
- name: image
|
||
|
usage: The image for the container to run.
|
||
|
- name: labels
|
||
|
shorthand: l
|
||
|
usage: Labels to apply to the pod(s).
|
||
|
- name: leave-stdin-open
|
||
|
default_value: "false"
|
||
|
usage: |
|
||
|
If the pod is started in interactive mode or with stdin, leave stdin open after the first attach completes. By default, stdin will be closed after the first attach completes.
|
||
|
- name: limits
|
||
|
usage: |
|
||
|
The resource requirement limits for this container. For example, 'cpu=200m,memory=512Mi'
|
||
|
- name: no-headers
|
||
|
default_value: "false"
|
||
|
usage: When using the default output, don't print headers.
|
||
|
- name: output
|
||
|
shorthand: o
|
||
|
usage: |
|
||
|
Output format. One of: json|yaml|wide|name|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md].
|
||
|
- name: output-version
|
||
|
usage: |
|
||
|
Output the formatted object with the given group version (for ex: 'extensions/v1beta1').
|
||
|
- name: overrides
|
||
|
usage: |
|
||
|
An inline JSON override for the generated object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field.
|
||
|
- name: port
|
||
|
default_value: "-1"
|
||
|
usage: |
|
||
|
The port that this container exposes. If --expose is true, this is also the port used by the service that is created.
|
||
|
- name: record
|
||
|
default_value: "false"
|
||
|
usage: Record current kubectl command in the resource annotation.
|
||
|
- name: replicas
|
||
|
shorthand: r
|
||
|
default_value: "1"
|
||
|
usage: |
|
||
|
Number of replicas to create for this container. Default is 1.
|
||
|
- name: requests
|
||
|
usage: |
|
||
|
The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'
|
||
|
- name: restart
|
||
|
default_value: Always
|
||
|
usage: |
|
||
|
The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a deployment is created for this pod, if set to OnFailure or Never, a job is created for this pod and --replicas must be 1. Default 'Always'
|
||
|
- name: rm
|
||
|
default_value: "false"
|
||
|
usage: |
|
||
|
If true, delete resources created in this command for attached containers.
|
||
|
- name: save-config
|
||
|
default_value: "false"
|
||
|
usage: |
|
||
|
If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future.
|
||
|
- name: service-generator
|
||
|
default_value: service/v2
|
||
|
usage: |
|
||
|
The name of the generator to use for creating a service. Only used if --expose is true
|
||
|
- name: service-overrides
|
||
|
usage: |
|
||
|
An inline JSON override for the generated service object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field. Only used if --expose is true.
|
||
|
- name: show-all
|
||
|
shorthand: a
|
||
|
default_value: "false"
|
||
|
usage: |
|
||
|
When printing, show all resources (default hide terminated pods.)
|
||
|
- name: show-labels
|
||
|
default_value: "false"
|
||
|
usage: |
|
||
|
When printing, show all labels as the last column (default hide labels column)
|
||
|
- name: sort-by
|
||
|
usage: |
|
||
|
If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
|
||
|
- name: stdin
|
||
|
shorthand: i
|
||
|
default_value: "false"
|
||
|
usage: |
|
||
|
Keep stdin open on the container(s) in the pod, even if nothing is attached.
|
||
|
- name: template
|
||
|
usage: |
|
||
|
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
|
||
|
- name: tty
|
||
|
default_value: "false"
|
||
|
usage: |
|
||
|
Allocated a TTY for each container in the pod. Because -t is currently shorthand for --template, -t is not supported for --tty. This shorthand is deprecated and we expect to adopt -t for --tty soon.
|
||
|
inherited_options:
|
||
|
- name: alsologtostderr
|
||
|
default_value: "false"
|
||
|
usage: log to standard error as well as files
|
||
|
- name: api-version
|
||
|
usage: |
|
||
|
DEPRECATED: The API version to use when talking to the server
|
||
|
- name: certificate-authority
|
||
|
usage: Path to a cert. file for the certificate authority.
|
||
|
- name: client-certificate
|
||
|
usage: Path to a client certificate file for TLS.
|
||
|
- name: client-key
|
||
|
usage: Path to a client key file for TLS.
|
||
|
- name: cluster
|
||
|
usage: The name of the kubeconfig cluster to use
|
||
|
- name: context
|
||
|
usage: The name of the kubeconfig context to use
|
||
|
- name: insecure-skip-tls-verify
|
||
|
default_value: "false"
|
||
|
usage: |
|
||
|
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
|
||
|
- name: kubeconfig
|
||
|
usage: Path to the kubeconfig file to use for CLI requests.
|
||
|
- name: log-backtrace-at
|
||
|
default_value: :0
|
||
|
usage: when logging hits line file:N, emit a stack trace
|
||
|
- name: log-dir
|
||
|
usage: If non-empty, write log files in this directory
|
||
|
- name: log-flush-frequency
|
||
|
default_value: 5s
|
||
|
usage: Maximum number of seconds between log flushes
|
||
|
- name: logtostderr
|
||
|
default_value: "true"
|
||
|
usage: log to standard error instead of files
|
||
|
- name: match-server-version
|
||
|
default_value: "false"
|
||
|
usage: Require server version to match client version
|
||
|
- name: namespace
|
||
|
usage: If present, the namespace scope for this CLI request.
|
||
|
- name: password
|
||
|
usage: Password for basic authentication to the API server.
|
||
|
- name: server
|
||
|
shorthand: s
|
||
|
usage: The address and port of the Kubernetes API server
|
||
|
- name: stderrthreshold
|
||
|
default_value: "2"
|
||
|
usage: logs at or above this threshold go to stderr
|
||
|
- name: token
|
||
|
usage: Bearer token for authentication to the API server.
|
||
|
- name: user
|
||
|
usage: The name of the kubeconfig user to use
|
||
|
- name: username
|
||
|
usage: Username for basic authentication to the API server.
|
||
|
- name: v
|
||
|
default_value: "0"
|
||
|
usage: log level for V logs
|
||
|
- name: vmodule
|
||
|
usage: |
|
||
|
comma-separated list of pattern=N settings for file-filtered logging
|
||
|
example: "# Start a single instance of nginx.\nkubectl run nginx --image=nginx\n\n#
|
||
|
Start a single instance of hazelcast and let the container expose port 5701 .\nkubectl
|
||
|
run hazelcast --image=hazelcast --port=5701\n\n# Start a single instance of hazelcast
|
||
|
and set environment variables \"DNS_DOMAIN=cluster\" and \"POD_NAMESPACE=default\"
|
||
|
in the container.\nkubectl run hazelcast --image=hazelcast --env=\"DNS_DOMAIN=cluster\"
|
||
|
--env=\"POD_NAMESPACE=default\"\n\n# Start a replicated instance of nginx.\nkubectl
|
||
|
run nginx --image=nginx --replicas=5\n\n# Dry run. Print the corresponding API objects
|
||
|
without creating them.\nkubectl run nginx --image=nginx --dry-run\n\n# Start a single
|
||
|
instance of nginx, but overload the spec of the deployment with a partial set of
|
||
|
values parsed from JSON.\nkubectl run nginx --image=nginx --overrides='{ \"apiVersion\":
|
||
|
\"v1\", \"spec\": { ... } }'\n\n# Start a single instance of busybox and keep it
|
||
|
in the foreground, don't restart it if it exits.\nkubectl run -i --tty busybox --image=busybox
|
||
|
--restart=Never\n\n# Start the nginx container using the default command, but use
|
||
|
custom arguments (arg1 .. argN) for that command.\nkubectl run nginx --image=nginx
|
||
|
-- <arg1> <arg2> ... <argN>\n\n# Start the nginx container using a different command
|
||
|
and custom arguments.\nkubectl run nginx --image=nginx --command -- <cmd> <arg1>
|
||
|
... <argN>\n\n# Start the perl container to compute π to 2000 places and print it
|
||
|
out.\nkubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle
|
||
|
'print bpi(2000)'"
|
||
|
see_also:
|
||
|
- kubectl
|