diff --git a/static/docs/reference/generated/kubectl/kubectl-commands.html b/static/docs/reference/generated/kubectl/kubectl-commands.html index 97b6efc8e8..c060bb0cef 100644 --- a/static/docs/reference/generated/kubectl/kubectl-commands.html +++ b/static/docs/reference/generated/kubectl/kubectl-commands.html @@ -11,7 +11,7 @@
- +--Start a single instance of nginx.
-
kubectl run nginx --image=nginx
-
---Start a single instance of hazelcast and let the container expose port 5701 .
-
kubectl run hazelcast --image=hazelcast --port=5701
-
---Start a single instance of hazelcast and set environment variables "DNS_DOMAIN=cluster" and "POD_NAMESPACE=default" in the container.
-
kubectl run hazelcast --image=hazelcast --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default"
-
---Start a single instance of hazelcast and set labels "app=hazelcast" and "env=prod" in the container.
-
kubectl run hazelcast --image=nginx --labels="app=hazelcast,env=prod"
-
---Start a replicated instance of nginx.
-
kubectl run nginx --image=nginx --replicas=5
-
---Dry run. Print the corresponding API objects without creating them.
-
kubectl run nginx --image=nginx --dry-run
-
---Start a single instance of nginx, but overload the spec of the deployment with a partial set of values parsed from JSON.
-
kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
-
---Start a pod of busybox and keep it in the foreground, don't restart it if it exits.
-
kubectl run -i -t busybox --image=busybox --restart=Never
-
---Start the nginx container using the default command, but use custom arguments (arg1 .. argN) for that command.
-
kubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN>
-
---Start the nginx container using a different command and custom arguments.
-
kubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>
-
---Start the perl container to compute π to 2000 places and print it out.
-
kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'
-
---Start the cron job to compute π to 2000 places and print it out every 5 minutes.
-
kubectl run pi --schedule="0/5 * * * ?" --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'
-
-Create and run a particular image, possibly replicated.
-Creates a deployment or job to manage the created container(s).
-$ run NAME --image=image [--env="key=value"] [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json] [--command] -- [COMMAND] [args...]
| Name | -Shorthand | -Default | -Usage | -
|---|---|---|---|
| allow-missing-template-keys | -- | true | -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. | -
| attach | -- | false | -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/--stdin' is set, in which case the default is true. With '--restart=Never' the exit code of the container process is returned. | -
| command | -- | false | -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. | -
| dry-run | -- | false | -If true, only print the object that would be sent, without sending it. | -
| env | -- | [] | -Environment variables to set in the container | -
| expose | -- | false | -If true, a public, external service is created for the container(s) which are run | -
| generator | -- | - | The name of the API generator to use, see http://kubernetes.io/docs/user-guide/kubectl-conventions/#generators for a list. | -
| hostport | -- | -1 | -The host port mapping for the container port. To demonstrate a single-machine container. | -
| image | -- | - | The image for the container to run. | -
| image-pull-policy | -- | - | The image pull policy for the container. If left empty, this value will not be specified by the client and defaulted by the server | -
| include-extended-apis | -- | true | -If true, include definitions of new APIs via calls to the API server. [default true] | -
| labels | -l | -- | Comma separated labels to apply to the pod(s). Will override previous values. | -
| leave-stdin-open | -- | false | -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. | -
| limits | -- | - | The resource requirement limits for this container. For example, 'cpu=200m,memory=512Mi'. Note that server side components may assign limits depending on the server configuration, such as limit ranges. | -
| no-headers | -- | false | -When using the default or custom-column output format, don't print headers (default print headers). | -
| output | -o | -- | Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. | -
| output-version | -- | - | DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). | -
| overrides | -- | - | 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. | -
| pod-running-timeout | -- | 1m0s | -The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running | -
| port | -- | - | The port that this container exposes. If --expose is true, this is also the port used by the service that is created. | -
| quiet | -- | false | -If true, suppress prompt messages. | -
| record | -- | false | -Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. | -
| replicas | -r | -1 | -Number of replicas to create for this container. Default is 1. | -
| requests | -- | - | The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'. Note that server side components may assign requests depending on the server configuration, such as limit ranges. | -
| restart | -- | Always | -The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a deployment is created, if set to 'OnFailure' a job is created, if set to 'Never', a regular pod is created. For the latter two --replicas must be 1. Default 'Always', for CronJobs Never. |
-
| rm | -- | false | -If true, delete resources created in this command for attached containers. | -
| save-config | -- | false | -If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. | -
| schedule | -- | - | A schedule in the Cron format the job should be run with. | -
| service-generator | -- | service/v2 | -The name of the generator to use for creating a service. Only used if --expose is true | -
| service-overrides | -- | - | 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. | -
| serviceaccount | -- | - | Service account to set in the pod spec | -
| show-all | -a | -true | -When printing, show all resources (default show all pods including terminated one.) | -
| show-labels | -- | false | -When printing, show all labels as the last column (default hide labels column) | -
| sort-by | -- | - | 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. | -
| stdin | -i | -false | -Keep stdin open on the container(s) in the pod, even if nothing is attached. | -
| template | -- | - | 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]. | -
| tty | -t | -false | -Allocated a TTY for each container in the pod. | -
--Start a single instance of nginx.
-
kubectl run nginx --image=nginx
-
---Start a single instance of hazelcast and let the container expose port 5701 .
-
kubectl run hazelcast --image=hazelcast --port=5701
-
---Start a single instance of hazelcast and set environment variables "DNS_DOMAIN=cluster" and "POD_NAMESPACE=default" in the container.
-
kubectl run hazelcast --image=hazelcast --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default"
-
---Start a single instance of hazelcast and set labels "app=hazelcast" and "env=prod" in the container.
-
kubectl run hazelcast --image=nginx --labels="app=hazelcast,env=prod"
-
---Start a replicated instance of nginx.
-
kubectl run nginx --image=nginx --replicas=5
-
---Dry run. Print the corresponding API objects without creating them.
-
kubectl run nginx --image=nginx --dry-run
-
---Start a single instance of nginx, but overload the spec of the deployment with a partial set of values parsed from JSON.
-
kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
-
---Start a pod of busybox and keep it in the foreground, don't restart it if it exits.
-
kubectl run -i -t busybox --image=busybox --restart=Never
-
---Start the nginx container using the default command, but use custom arguments (arg1 .. argN) for that command.
-
kubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN>
-
---Start the nginx container using a different command and custom arguments.
-
kubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>
-
---Start the perl container to compute π to 2000 places and print it out.
-
kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'
-
---Start the cron job to compute π to 2000 places and print it out every 5 minutes.
-
kubectl run pi --schedule="0/5 * * * ?" --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'
-
-Create and run a particular image, possibly replicated.
-Creates a deployment or job to manage the created container(s).
-$ run-container
| Name | -Shorthand | -Default | -Usage | -
|---|---|---|---|
| allow-missing-template-keys | -- | true | -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. | -
| attach | -- | false | -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/--stdin' is set, in which case the default is true. With '--restart=Never' the exit code of the container process is returned. | -
| command | -- | false | -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. | -
| dry-run | -- | false | -If true, only print the object that would be sent, without sending it. | -
| env | -- | [] | -Environment variables to set in the container | -
| expose | -- | false | -If true, a public, external service is created for the container(s) which are run | -
| generator | -- | - | The name of the API generator to use, see http://kubernetes.io/docs/user-guide/kubectl-conventions/#generators for a list. | -
| hostport | -- | -1 | -The host port mapping for the container port. To demonstrate a single-machine container. | -
| image | -- | - | The image for the container to run. | -
| image-pull-policy | -- | - | The image pull policy for the container. If left empty, this value will not be specified by the client and defaulted by the server | -
| include-extended-apis | -- | true | -If true, include definitions of new APIs via calls to the API server. [default true] | -
| labels | -l | -- | Comma separated labels to apply to the pod(s). Will override previous values. | -
| leave-stdin-open | -- | false | -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. | -
| limits | -- | - | The resource requirement limits for this container. For example, 'cpu=200m,memory=512Mi'. Note that server side components may assign limits depending on the server configuration, such as limit ranges. | -
| no-headers | -- | false | -When using the default or custom-column output format, don't print headers (default print headers). | -
| output | -o | -- | Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. | -
| output-version | -- | - | DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). | -
| overrides | -- | - | 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. | -
| pod-running-timeout | -- | 1m0s | -The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running | -
| port | -- | - | The port that this container exposes. If --expose is true, this is also the port used by the service that is created. | -
| quiet | -- | false | -If true, suppress prompt messages. | -
| record | -- | false | -Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. | -
| replicas | -r | -1 | -Number of replicas to create for this container. Default is 1. | -
| requests | -- | - | The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'. Note that server side components may assign requests depending on the server configuration, such as limit ranges. | -
| restart | -- | Always | -The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a deployment is created, if set to 'OnFailure' a job is created, if set to 'Never', a regular pod is created. For the latter two --replicas must be 1. Default 'Always', for CronJobs Never. |
-
| rm | -- | false | -If true, delete resources created in this command for attached containers. | -
| save-config | -- | false | -If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. | -
| schedule | -- | - | A schedule in the Cron format the job should be run with. | -
| service-generator | -- | service/v2 | -The name of the generator to use for creating a service. Only used if --expose is true | -
| service-overrides | -- | - | 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. | -
| serviceaccount | -- | - | Service account to set in the pod spec | -
| show-all | -a | -true | -When printing, show all resources (default show all pods including terminated one.) | -
| show-labels | -- | false | -When printing, show all labels as the last column (default hide labels column) | -
| sort-by | -- | - | 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. | -
| stdin | -i | -false | -Keep stdin open on the container(s) in the pod, even if nothing is attached. | -
| template | -- | - | 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]. | -
| tty | -t | -false | -Allocated a TTY for each container in the pod. | -
--Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000.
-
kubectl expose rc nginx --port=80 --target-port=8000
-
---Create a service for a replication controller identified by type and name specified in "nginx-controller.yaml", which serves on port 80 and connects to the containers on port 8000.
-
kubectl expose -f nginx-controller.yaml --port=80 --target-port=8000
-
---Create a service for a pod valid-pod, which serves on port 444 with the name "frontend"
-
kubectl expose pod valid-pod --port=444 --name=frontend
-
---Create a second service based on the above service, exposing the container port 8443 as port 443 with the name "nginx-https"
-
kubectl expose service nginx --port=443 --target-port=8443 --name=nginx-https
-
---Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named 'video-stream'.
-
kubectl expose rc streamer --port=4100 --protocol=udp --name=video-stream
-
---Create a service for a replicated nginx using replica set, which serves on port 80 and connects to the containers on port 8000.
-
kubectl expose rs nginx --port=80 --target-port=8000
-
---Create a service for an nginx deployment, which serves on port 80 and connects to the containers on port 8000.
-
kubectl expose deployment nginx --port=80 --target-port=8000
-
-Expose a resource as a new Kubernetes service.
-Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. A deployment or replica set will be exposed as a service only if its selector is convertible to a selector that service supports, i.e. when the selector contains only the matchLabels component. Note that if no port is specified via --port and the exposed resource has multiple ports, all will be re-used by the new service. Also if no labels are specified, the new service will re-use the labels from the resource it exposes.
-Possible resources include (case insensitive):
-pod (po), service (svc), replicationcontroller (rc), deployment (deploy), replicaset (rs)
-$ expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]
| Name | -Shorthand | -Default | -Usage | -
|---|---|---|---|
| allow-missing-template-keys | -- | true | -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. | -
| cluster-ip | -- | - | ClusterIP to be assigned to the service. Leave empty to auto-allocate, or set to 'None' to create a headless service. | -
| container-port | -- | - | Synonym for --target-port | -
| dry-run | -- | false | -If true, only print the object that would be sent, without sending it. | -
| external-ip | -- | - | Additional external IP address (not managed by Kubernetes) to accept for the service. If this IP is routed to a node, the service can be accessed by this IP in addition to its generated service IP. | -
| filename | -f | -[] | -Filename, directory, or URL to files identifying the resource to expose a service | -
| generator | -- | service/v2 | -The name of the API generator to use. There are 2 generators: 'service/v1' and 'service/v2'. The only difference between them is that service port in v1 is named 'default', while it is left unnamed in v2. Default is 'service/v2'. | -
| labels | -l | -- | Labels to apply to the service created by this call. | -
| load-balancer-ip | -- | - | IP to assign to the LoadBalancer. If empty, an ephemeral IP will be created and used (cloud-provider specific). | -
| name | -- | - | The name for the newly created object. | -
| no-headers | -- | false | -When using the default or custom-column output format, don't print headers (default print headers). | -
| output | -o | -- | Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. | -
| output-version | -- | - | DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). | -
| overrides | -- | - | 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. | -
| port | -- | - | The port that the service should serve on. Copied from the resource being exposed, if unspecified | -
| protocol | -- | - | The network protocol for the service to be created. Default is 'TCP'. | -
| record | -- | false | -Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. | -
| recursive | -R | -false | -Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. | -
| save-config | -- | false | -If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. | -
| selector | -- | - | A label selector to use for this service. Only equality-based selector requirements are supported. If empty (the default) infer the selector from the replication controller or replica set.) | -
| session-affinity | -- | - | If non-empty, set the session affinity for the service to this; legal values: 'None', 'ClientIP' | -
| show-all | -a | -true | -When printing, show all resources (default show all pods including terminated one.) | -
| show-labels | -- | false | -When printing, show all labels as the last column (default hide labels column) | -
| sort-by | -- | - | 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. | -
| target-port | -- | - | Name or number for the port on the container that the service should direct traffic to. Optional. | -
| template | -- | - | 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]. | -
| type | -- | - | Type for this service: ClusterIP, NodePort, LoadBalancer, or ExternalName. Default is 'ClusterIP'. | -
This section contains commands for creating, updating, deleting, and -viewing your workloads in a Kubernetes cluster.
---Update pod 'foo' with the annotation 'description' and the value 'my frontend'. # If the same annotation is set multiple times, only the last value will be applied
-
kubectl annotate pods foo description='my frontend'
-
---Update a pod identified by type and name in "pod.json"
-
kubectl annotate -f pod.json description='my frontend'
-
---Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value.
-
kubectl annotate --overwrite pods foo description='my frontend running nginx'
-
---Update all pods in the namespace
-
kubectl annotate pods --all description='my frontend running nginx'
-
---Update pod 'foo' only if the resource is unchanged from version 1.
-
kubectl annotate pods foo description='my frontend running nginx' --resource-version=1
-
---Update pod 'foo' by removing an annotation named 'description' if it exists. # Does not require the --overwrite flag.
-
kubectl annotate pods foo description-
-
-Update the annotations on one or more resources
-All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary string values such as structured JSON. Tools and system extensions may use annotations to store their own data.
-Attempting to set an annotation that already exists will fail unless --overwrite is set. If --resource-version is specified and does not match the current resource version on the server the command will fail.
-Valid resource types include:
-$ annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]
| Name | -Shorthand | -Default | -Usage | -
|---|---|---|---|
| all | -- | false | -Select all resources, including uninitialized ones, in the namespace of the specified resource types. | -
| allow-missing-template-keys | -- | true | -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. | -
| dry-run | -- | false | -If true, only print the object that would be sent, without sending it. | -
| filename | -f | -[] | -Filename, directory, or URL to files identifying the resource to update the annotation | -
| include-extended-apis | -- | true | -If true, include definitions of new APIs via calls to the API server. [default true] | -
| include-uninitialized | -- | false | -If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., "--all". Objects with empty metadata.initializers are regarded as initialized. | -
| local | -- | false | -If true, annotation will NOT contact api-server but run locally. | -
| no-headers | -- | false | -When using the default or custom-column output format, don't print headers (default print headers). | -
| output | -o | -- | Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. | -
| output-version | -- | - | DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). | -
| overwrite | -- | false | -If true, allow annotations to be overwritten, otherwise reject annotation updates that overwrite existing annotations. | -
| record | -- | false | -Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. | -
| recursive | -R | -false | -Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. | -
| resource-version | -- | - | If non-empty, the annotation update will only succeed if this is the current resource-version for the object. Only valid when specifying a single resource. | -
| selector | -l | -- | Selector (label query) to filter on, not including uninitialized ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). | -
| show-all | -a | -true | -When printing, show all resources (default show all pods including terminated one.) | -
| show-labels | -- | false | -When printing, show all labels as the last column (default hide labels column) | -
| sort-by | -- | - | 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. | -
| template | -- | - | 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]. | -
--Auto scale a deployment "foo", with the number of pods between 2 and 10, no target CPU utilization specified so a default autoscaling policy will be used:
-
kubectl autoscale deployment foo --min=2 --max=10
-
---Auto scale a replication controller "foo", with the number of pods between 1 and 5, target CPU utilization at 80%:
-
kubectl autoscale rc foo --max=5 --cpu-percent=80
-
-Creates an autoscaler that automatically chooses and sets the number of pods that run in a kubernetes cluster.
-Looks up a Deployment, ReplicaSet, or ReplicationController by name and creates an autoscaler that uses the given resource as a reference. An autoscaler can automatically increase or decrease number of pods deployed within the system as needed.
-$ autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU]
| Name | -Shorthand | -Default | -Usage | -
|---|---|---|---|
| allow-missing-template-keys | -- | true | -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. | -
| cpu-percent | -- | -1 | -The target average CPU utilization (represented as a percent of requested CPU) over all the pods. If it's not specified or negative, a default autoscaling policy will be used. | -
| dry-run | -- | false | -If true, only print the object that would be sent, without sending it. | -
| filename | -f | -[] | -Filename, directory, or URL to files identifying the resource to autoscale. | -
| generator | -- | horizontalpodautoscaler/v1 | -The name of the API generator to use. Currently there is only 1 generator. | -
| include-extended-apis | -- | true | -If true, include definitions of new APIs via calls to the API server. [default true] | -
| max | -- | -1 | -The upper limit for the number of pods that can be set by the autoscaler. Required. | -
| min | -- | -1 | -The lower limit for the number of pods that can be set by the autoscaler. If it's not specified or negative, the server will apply a default value. | -
| name | -- | - | The name for the newly created object. If not specified, the name of the input resource will be used. | -
| no-headers | -- | false | -When using the default or custom-column output format, don't print headers (default print headers). | -
| output | -o | -- | Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. | -
| output-version | -- | - | DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). | -
| record | -- | false | -Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. | -
| recursive | -R | -false | -Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. | -
| save-config | -- | false | -If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. | -
| show-all | -a | -true | -When printing, show all resources (default show all pods including terminated one.) | -
| show-labels | -- | false | -When printing, show all labels as the last column (default hide labels column) | -
| sort-by | -- | - | 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. | -
| template | -- | - | 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]. | -
--Convert 'pod.yaml' to latest version and print to stdout.
-
kubectl convert -f pod.yaml
-
---Convert the live state of the resource specified by 'pod.yaml' to the latest version # and print to stdout in JSON format.
-
kubectl convert -f pod.yaml --local -o json
-
---Convert all files under current directory to latest version and create them all.
-
kubectl convert -f . | kubectl create -f -
-
-Convert config files between different API versions. Both YAML and JSON formats are accepted.
-The command takes filename, directory, or URL as input, and convert it into format of version specified by --output-version flag. If target version is not specified or not supported, convert to latest version.
-The default output will be printed to stdout in YAML format. One can use -o option to change to output destination.
-$ convert -f FILENAME
| Name | -Shorthand | -Default | -Usage | -
|---|---|---|---|
| allow-missing-template-keys | -- | true | -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. | -
| filename | -f | -[] | -Filename, directory, or URL to files to need to get converted. | -
| include-extended-apis | -- | true | -If true, include definitions of new APIs via calls to the API server. [default true] | -
| local | -- | true | -If true, convert will NOT try to contact api-server but run locally. | -
| no-headers | -- | false | -When using the default or custom-column output format, don't print headers (default print headers). | -
| output | -o | -- | Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. | -
| output-version | -- | - | Output the formatted object with the given group version (for ex: 'extensions/v1beta1').) | -
| recursive | -R | -false | -Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. | -
| show-all | -a | -true | -When printing, show all resources (default show all pods including terminated one.) | -
| show-labels | -- | false | -When printing, show all labels as the last column (default hide labels column) | -
| sort-by | -- | - | 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. | -
| template | -- | - | 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]. | -
| validate | -- | true | -If true, use a schema to validate the input before sending it | -
Create a pod using the data in pod.json.
@@ -1320,9 +37,9 @@ viewing your workloads in a Kubernetes cluster.cat pod.json | kubectl create -f ---Edit the data in docker-registry.yaml in JSON using the v1 API format then create the resource using the edited data.
+Edit the data in docker-registry.yaml in JSON then create the resource using the edited data.
kubectl create -f docker-registry.yaml --edit --output-version=v1 -o json +kubectl create -f docker-registry.yaml --edit -o jsonCreate a resource from a file or from stdin.
JSON and YAML formats are accepted.
@@ -1364,30 +81,12 @@ viewing your workloads in a Kubernetes cluster.Filename, directory, or URL to files to use to create the resource - -include-extended-apis -- true -If true, include definitions of new APIs via calls to the API server. [default true] -- -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -raw @@ -1418,24 +117,6 @@ viewing your workloads in a Kubernetes cluster. Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -template @@ -1465,7 +146,7 @@ viewing your workloads in a Kubernetes cluster. -Create a ClusterRole named "pod-reader" with ResourceName specified
kubectl create clusterrole pod-reader --verb=get,list,watch --resource=pods --resource-name=readablepod --resource-name=anotherpod +kubectl create clusterrole pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpodCreate a ClusterRole named "foo" with API Group specified
@@ -1482,6 +163,11 @@ viewing your workloads in a Kubernetes cluster.+kubectl create clusterrole "foo" --verb=get --non-resource-url=/logs/*++Create a ClusterRole name "monitoring" with AggregationRule specified
+kubectl create clusterrole monitoring --aggregation-rule="rbac.example.com/aggregate-to-monitoring=true" +Create a ClusterRole.
Usage
@@ -1497,6 +183,12 @@ viewing your workloads in a Kubernetes cluster.
$ clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run]+ +aggregation-rule ++ + An aggregation label selector for combining ClusterRoles. +allow-missing-template-keys true @@ -1509,12 +201,6 @@ viewing your workloads in a Kubernetes cluster.If true, only print the object that would be sent, without sending it. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -non-resource-url [] @@ -1527,12 +213,6 @@ viewing your workloads in a Kubernetes cluster.Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -resource [] @@ -1551,24 +231,6 @@ viewing your workloads in a Kubernetes cluster.If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -template @@ -1640,24 +302,12 @@ viewing your workloads in a Kubernetes cluster. Groups to bind to the role - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -save-config false @@ -1670,24 +320,6 @@ viewing your workloads in a Kubernetes cluster.Service accounts to bind to the role, in the format : - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -template @@ -1788,48 +420,18 @@ viewing your workloads in a Kubernetes cluster. The name of the API generator to use. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -save-config false If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -template @@ -1879,7 +481,7 @@ viewing your workloads in a Kubernetes cluster. generator - deployment-basic/v1beta1 +The name of the API generator to use. @@ -1889,48 +491,18 @@ viewing your workloads in a Kubernetes cluster. Image name to run. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -save-config false If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -template @@ -1949,11 +521,11 @@ viewing your workloads in a Kubernetes cluster. -Create a job from a CronJob named "a-cronjob"
kubectl create job --from=cronjob/a-cronjob +kubectl create job test-job --from=cronjob/a-cronjobCreate a job with the specified name.
Usage
-+
$ job NAME [--from-cronjob=CRONJOB]
$ job NAME [--from=CRONJOB]Flags
@@ -1972,54 +544,30 @@ viewing your workloads in a Kubernetes cluster.
+If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. + +dry-run ++ false +If true, only print the object that would be sent, without sending it. +from The name of the resource to create a Job from (only cronjob is supported). - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -save-config false If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -template @@ -2073,48 +621,18 @@ viewing your workloads in a Kubernetes cluster. The name of the API generator to use. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -save-config false If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -template @@ -2185,24 +703,12 @@ viewing your workloads in a Kubernetes cluster. The minimum number or percentage of available pods this budget requires. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -save-config false @@ -2215,24 +721,6 @@ viewing your workloads in a Kubernetes cluster.A label selector to use for this budget. Only equality-based selector requirements are supported. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -template @@ -2303,48 +791,18 @@ viewing your workloads in a Kubernetes cluster. global-default specifies whether this PriorityClass should be considered as the default priority. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -save-config false If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -template @@ -2415,24 +873,12 @@ viewing your workloads in a Kubernetes cluster. A comma-delimited set of resource=quantity pairs that define a hard limit. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -save-config false @@ -2445,24 +891,6 @@ viewing your workloads in a Kubernetes cluster.A comma-delimited set of quota scopes that must all match each object tracked by the quota. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -template @@ -2486,7 +914,7 @@ viewing your workloads in a Kubernetes cluster. -Create a Role named "pod-reader" with ResourceName specified
kubectl create role pod-reader --verb=get,list,watch --resource=pods --resource-name=readablepod --resource-name=anotherpod +kubectl create role pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpodCreate a Role named "foo" with API Group specified
@@ -2525,24 +953,12 @@ viewing your workloads in a Kubernetes cluster.If true, only print the object that would be sent, without sending it. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -resource [] @@ -2561,24 +977,6 @@ viewing your workloads in a Kubernetes cluster.If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -template @@ -2650,24 +1048,12 @@ viewing your workloads in a Kubernetes cluster. Groups to bind to the role - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -role @@ -2686,24 +1072,6 @@ viewing your workloads in a Kubernetes cluster. Service accounts to bind to the role, in the format : - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -template @@ -2729,12 +1097,14 @@ viewing your workloads in a Kubernetes cluster. -kubectl create secret docker-registry my-secret --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAILCreate a new secret for use with Docker registries.
-Dockercfg secrets are used to authenticate against Docker registries.
-When using the Docker command line to push images, you can authenticate to a given registry by running: '$ docker login DOCKER REGISTRY SERVER --username=DOCKER USER --password=DOCKER PASSWORD --email=DOCKER _EMAIL'.
-That produces a ~/.dockercfg file that is used by subsequent 'docker push' and 'docker pull' commands to
-authenticate to the registry. The email address is optional.
-When creating applications, you may have a Docker registry that requires authentication. In order for the nodes to pull images on your behalf, they have to have the credentials. You can provide this information by creating a dockercfg secret and attaching it to your service account.
+Create a new secret for use with Docker registries.
+Dockercfg secrets are used to authenticate against Docker registries.
+When using the Docker command line to push images, you can authenticate to a given registry by running: + '$ docker login DOCKER_REGISTRY_SERVER --username=DOCKER_USER --password=DOCKER_PASSWORD --email=DOCKER_EMAIL'.
+That produces a ~/.dockercfg file that is used by subsequent 'docker push' and 'docker pull' commands to authenticate to the registry. The email address is optional.
+When creating applications, you may have a Docker registry that requires authentication. In order for the + nodes to pull images on your behalf, they have to have the credentials. You can provide this information + by creating a dockercfg secret and attaching it to your service account.
Usage
$ docker-registry NAME --docker-username=user --docker-password=password --docker-email=email [--docker-server=string] [--from-literal=key1=value1] [--dry-run]Flags
@@ -2791,60 +1161,30 @@ viewing your workloads in a Kubernetes cluster.If true, only print the object that would be sent, without sending it. + +from-file ++ [] +Key files can be specified using their file path, in which case a default name will be given to them, or optionally with a name and file path, in which case the given name will be used. Specifying a directory will iterate each named file in the directory that is a valid secret key. +generator secret-for-docker-registry/v1 The name of the API generator to use. - -include-extended-apis -- true -If true, include definitions of new APIs via calls to the API server. [default true] -- -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -save-config false If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -template @@ -2945,48 +1285,18 @@ viewing your workloads in a Kubernetes cluster. The name of the API generator to use. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -save-config false If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -template @@ -3065,48 +1375,18 @@ viewing your workloads in a Kubernetes cluster. Path to private key associated with given certificate. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -save-config false If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -template @@ -3176,48 +1456,18 @@ viewing your workloads in a Kubernetes cluster. The name of the API generator to use. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -save-config false If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -tcp [] @@ -3284,48 +1534,18 @@ viewing your workloads in a Kubernetes cluster.The name of the API generator to use. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -save-config false If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -tcp [] @@ -3385,48 +1605,18 @@ viewing your workloads in a Kubernetes cluster.The name of the API generator to use. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -save-config false If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -tcp [] @@ -3486,12 +1676,6 @@ viewing your workloads in a Kubernetes cluster.The name of the API generator to use. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -node-port 0 @@ -3504,36 +1688,12 @@ viewing your workloads in a Kubernetes cluster.Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -save-config false If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -tcp [] @@ -3593,10 +1753,149 @@ viewing your workloads in a Kubernetes cluster.The name of the API generator to use. - +include-extended-apis +output +o ++ Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. ++ +save-config ++ false +If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. ++ +template ++ + 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]. ++ + +validate true -If true, include definitions of new APIs via calls to the API server. [default true] +If true, use a schema to validate the input before sending it +
+get
+++List all pods in ps output format.
++kubectl get pods +++List all pods in ps output format with more information (such as node name).
++kubectl get pods -o wide +++List a single replication controller with specified NAME in ps output format.
++kubectl get replicationcontroller web +++List deployments in JSON output format, in the "v1" version of the "apps" API group:
++kubectl get deployments.v1.apps -o json +++List a single pod in JSON output format.
++kubectl get -o json pod web-pod-13je7 +++List a pod identified by type and name specified in "pod.yaml" in JSON output format.
++kubectl get -f pod.yaml -o json +++Return only the phase value of the specified pod.
++kubectl get -o template pod/web-pod-13je7 --template={{.status.phase}} +++List all replication controllers and services together in ps output format.
++kubectl get rc,services +++List one or more resources by their type and names.
++kubectl get rc/web service/frontend pods/web-pod-13je7 +Display one or many resources
+Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will only see results in your current namespace unless you pass --all-namespaces.
+Uninitialized objects are not shown unless --include-uninitialized is passed.
+By specifying the output as 'template' and providing a Go template as the value of the --template flag, you can filter the attributes of the fetched resources.
+Use "kubectl api-resources" for a complete list of supported resources.
+Usage
++
$ get [(-o|--output=)json|yaml|wide|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=...] (TYPE[.VERSION][.GROUP] [NAME | -l label] | TYPE[.VERSION][.GROUP]/NAME ...) [flags]Flags
++ +
++ + + +Name +Shorthand +Default +Usage ++ +all-namespaces ++ false +If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace. ++ +allow-missing-template-keys ++ true +If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. ++ +chunk-size ++ 500 +Return large lists in chunks rather than all at once. Pass 0 to disable. This flag is beta and may change in the future. ++ +export ++ false +If true, use 'export' for the resources. Exported resources are stripped of cluster-specific information. ++ +field-selector ++ + Selector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type. ++ +filename +f +[] +Filename, directory, or URL to files identifying the resource to get from a server. ++ +ignore-not-found ++ false +If the requested object does not exist the command will return exit code 0. ++ +include-uninitialized ++ false +If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., "--all". Objects with empty metadata.initializers are regarded as initialized. ++ label-columns +L +[] +Accepts a comma separated list of labels that are going to be presented as columns. Names are case-sensitive. You can also use multiple flag options like -L label1 -L label2... no-headers @@ -3611,16 +1910,28 @@ viewing your workloads in a Kubernetes cluster.Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - output-version +raw - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). +Raw URI to request from the server. Uses the transport specified by the kubeconfig file. - +save-config -+ recursive +R false -If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. +Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. ++ +selector +l ++ Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) ++ server-print ++ true +If true, have the server return the appropriate table output. Supports extension APIs and CRDs. show-all @@ -3629,6 +1940,12 @@ viewing your workloads in a Kubernetes cluster.When printing, show all resources (default show all pods including terminated one.) + +show-kind ++ false +If present, list the resource type for the requested object(s). +show-labels false @@ -3647,10 +1964,493 @@ viewing your workloads in a Kubernetes cluster.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]. - +validate +use-openapi-print-columns ++ false +If true, use x-kubernetes-print-column metadata (if present) from the OpenAPI schema for displaying a resource. ++ +watch +w +false +After listing/getting the requested object, watch for changes. Uninitialized objects are excluded if no object name is provided. ++ + +watch-only ++ false +Watch for changes to the requested object(s), without listing/getting first. +
+run
+++Start a single instance of nginx.
++kubectl run nginx --image=nginx +++Start a single instance of hazelcast and let the container expose port 5701 .
++kubectl run hazelcast --image=hazelcast --port=5701 +++Start a single instance of hazelcast and set environment variables "DNS_DOMAIN=cluster" and "POD_NAMESPACE=default" in the container.
++kubectl run hazelcast --image=hazelcast --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default" +++Start a single instance of hazelcast and set labels "app=hazelcast" and "env=prod" in the container.
++kubectl run hazelcast --image=nginx --labels="app=hazelcast,env=prod" +++Start a replicated instance of nginx.
++kubectl run nginx --image=nginx --replicas=5 +++Dry run. Print the corresponding API objects without creating them.
++kubectl run nginx --image=nginx --dry-run +++Start a single instance of nginx, but overload the spec of the deployment with a partial set of values parsed from JSON.
++kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }' +++Start a pod of busybox and keep it in the foreground, don't restart it if it exits.
++kubectl run -i -t busybox --image=busybox --restart=Never +++Start the nginx container using the default command, but use custom arguments (arg1 .. argN) for that command.
++kubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN> +++Start the nginx container using a different command and custom arguments.
++kubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN> +++Start the perl container to compute π to 2000 places and print it out.
++kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)' +++Start the cron job to compute π to 2000 places and print it out every 5 minutes.
++kubectl run pi --schedule="0/5 * * * ?" --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)' +Create and run a particular image, possibly replicated.
+Creates a deployment or job to manage the created container(s).
+Usage
++
$ run NAME --image=image [--env="key=value"] [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json] [--command] -- [COMMAND] [args...]Flags
++ +
++ + + +Name +Shorthand +Default +Usage ++ +attach ++ false +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/--stdin' is set, in which case the default is true. With '--restart=Never' the exit code of the container process is returned. ++ +cascade true -If true, use a schema to validate the input before sending it +If true, cascade the deletion of the resources managed by this resource (e.g. Pods created by a ReplicationController). Default true. ++ +command ++ false +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. ++ +dry-run ++ false +If true, only print the object that would be sent, without sending it. ++ +env ++ [] +Environment variables to set in the container ++ +expose ++ false +If true, a public, external service is created for the container(s) which are run ++ +filename +f +[] +to use to replace the resource. ++ +force ++ false +Only used when grace-period=0. If true, immediately remove resources from API and bypass graceful deletion. Note that immediate deletion of some resources may result in inconsistency or data loss and requires confirmation. ++ +generator ++ + The name of the API generator to use, see http://kubernetes.io/docs/user-guide/kubectl-conventions/#generators for a list. ++ +grace-period ++ -1 +Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. Set to 1 for immediate shutdown. Can only be set to 0 when --force is true (force deletion). ++ +hostport ++ -1 +The host port mapping for the container port. To demonstrate a single-machine container. ++ +image ++ + The image for the container to run. ++ +image-pull-policy ++ + The image pull policy for the container. If left empty, this value will not be specified by the client and defaulted by the server ++ +labels +l ++ Comma separated labels to apply to the pod(s). Will override previous values. ++ +leave-stdin-open ++ false +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. ++ +limits ++ + The resource requirement limits for this container. For example, 'cpu=200m,memory=512Mi'. Note that server side components may assign limits depending on the server configuration, such as limit ranges. ++ +output +o ++ Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. ++ +overrides ++ + 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. ++ +pod-running-timeout ++ 1m0s +The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running ++ +port ++ + The port that this container exposes. If --expose is true, this is also the port used by the service that is created. ++ +quiet ++ false +If true, suppress prompt messages. ++ +record ++ false +Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. ++ +recursive +R +false +Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. ++ +replicas +r +1 +Number of replicas to create for this container. Default is 1. ++ +requests ++ + The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'. Note that server side components may assign requests depending on the server configuration, such as limit ranges. ++ +restart ++ Always +The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a deployment is created, if set to 'OnFailure' a job is created, if set to 'Never', a regular pod is created. For the latter two --replicas must be 1. Default 'Always', for CronJobs +Never.+ +rm ++ false +If true, delete resources created in this command for attached containers. ++ +save-config ++ false +If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. ++ +schedule ++ + A schedule in the Cron format the job should be run with. ++ +service-generator ++ service/v2 +The name of the generator to use for creating a service. Only used if --expose is true ++ +service-overrides ++ + 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. ++ +serviceaccount ++ + Service account to set in the pod spec ++ +stdin +i +false +Keep stdin open on the container(s) in the pod, even if nothing is attached. ++ +timeout ++ 0s +The length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object ++ +tty +t +false +Allocated a TTY for each container in the pod. ++ + +wait ++ false +If true, wait for resources to be gone before returning. This waits for finalizers. +
+expose
+++Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000.
++kubectl expose rc nginx --port=80 --target-port=8000 +++Create a service for a replication controller identified by type and name specified in "nginx-controller.yaml", which serves on port 80 and connects to the containers on port 8000.
++kubectl expose -f nginx-controller.yaml --port=80 --target-port=8000 +++Create a service for a pod valid-pod, which serves on port 444 with the name "frontend"
++kubectl expose pod valid-pod --port=444 --name=frontend +++Create a second service based on the above service, exposing the container port 8443 as port 443 with the name "nginx-https"
++kubectl expose service nginx --port=443 --target-port=8443 --name=nginx-https +++Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named 'video-stream'.
++kubectl expose rc streamer --port=4100 --protocol=udp --name=video-stream +++Create a service for a replicated nginx using replica set, which serves on port 80 and connects to the containers on port 8000.
++kubectl expose rs nginx --port=80 --target-port=8000 +++Create a service for an nginx deployment, which serves on port 80 and connects to the containers on port 8000.
++kubectl expose deployment nginx --port=80 --target-port=8000 +Expose a resource as a new Kubernetes service.
+Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. A deployment or replica set will be exposed as a service only if its selector is convertible to a selector that service supports, i.e. when the selector contains only the matchLabels component. Note that if no port is specified via --port and the exposed resource has multiple ports, all will be re-used by the new service. Also if no labels are specified, the new service will re-use the labels from the resource it exposes.
+Possible resources include (case insensitive):
+pod (po), service (svc), replicationcontroller (rc), deployment (deploy), replicaset (rs)
+Usage
++
$ expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]Flags
++ +
@@ -3722,22 +2522,28 @@ viewing your workloads in a Kubernetes cluster.+ + + +Name +Shorthand +Default +Usage ++ +cluster-ip ++ + ClusterIP to be assigned to the service. Leave empty to auto-allocate, or set to 'None' to create a headless service. ++ +container-port ++ + Synonym for --target-port ++ +dry-run ++ false +If true, only print the object that would be sent, without sending it. ++ +external-ip ++ + Additional external IP address (not managed by Kubernetes) to accept for the service. If this IP is routed to a node, the service can be accessed by this IP in addition to its generated service IP. ++ +filename +f +[] +Filename, directory, or URL to files identifying the resource to expose a service ++ +generator ++ service/v2 +The name of the API generator to use. There are 2 generators: 'service/v1' and 'service/v2'. The only difference between them is that service port in v1 is named 'default', while it is left unnamed in v2. Default is 'service/v2'. ++ +labels +l ++ Labels to apply to the service created by this call. ++ +load-balancer-ip ++ + IP to assign to the LoadBalancer. If empty, an ephemeral IP will be created and used (cloud-provider specific). ++ +name ++ + The name for the newly created object. ++ +output +o ++ Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. ++ +overrides ++ + 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. ++ +port ++ + The port that the service should serve on. Copied from the resource being exposed, if unspecified ++ +protocol ++ + The network protocol for the service to be created. Default is 'TCP'. ++ +record ++ false +Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. ++ +recursive +R +false +Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. ++ +save-config ++ false +If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. ++ +selector ++ + A label selector to use for this service. Only equality-based selector requirements are supported. If empty (the default) infer the selector from the replication controller or replica set.) ++ +session-affinity ++ + If non-empty, set the session affinity for the service to this; legal values: 'None', 'ClientIP' ++ +target-port ++ + Name or number for the port on the container that the service should direct traffic to. Optional. ++ type ++ + Type for this service: ClusterIP, NodePort, LoadBalancer, or ExternalName. Default is 'ClusterIP'. If true, cascade the deletion of the resources managed by this resource (e.g. Pods created by a ReplicationController). Default true. + +field-selector ++ + Selector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type. +filename f [] -Filename, directory, or URL to files containing the resource to delete. +containing the resource to delete. force false -Immediate deletion of some resources may result in inconsistency or data loss and requires confirmation. +Only used when grace-period=0. If true, immediately remove resources from API and bypass graceful deletion. Note that immediate deletion of some resources may result in inconsistency or data loss and requires confirmation. grace-period -1 -Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. +Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. Set to 1 for immediate shutdown. Can only be set to 0 when --force is true (force deletion). ignore-not-found @@ -3746,12 +2552,6 @@ viewing your workloads in a Kubernetes cluster.Treat "resource not found" as a successful delete. Defaults to "true" when --all is specified. - -include-extended-apis -- true -If true, include definitions of new APIs via calls to the API server. [default true] -+ include-uninitialized false @@ -3787,6 +2587,636 @@ viewing your workloads in a Kubernetes cluster.0s The length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object + + + +wait ++ true +If true, wait for resources to be gone before returning. This waits for finalizers. +APP MANAGEMENT
+This section contains commands for creating, updating, deleting, and +viewing your workloads in a Kubernetes cluster.
+
+apply
+++Apply the configuration in pod.json to a pod.
++kubectl apply -f ./pod.json +++Apply the JSON passed into stdin to a pod.
++cat pod.json | kubectl apply -f - +++Note: --prune is still in Alpha # Apply the configuration in manifest.yaml that matches label app=nginx and delete all the other resources that are not in the file and match label app=nginx.
++kubectl apply --prune -f manifest.yaml -l app=nginx +++Apply the configuration in manifest.yaml and delete all the other configmaps that are not in the file.
++kubectl apply --prune -f manifest.yaml --all --prune-whitelist=core/v1/ConfigMap +Apply a configuration to a resource by filename or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initially with either 'apply' or 'create --save-config'.
+JSON and YAML formats are accepted.
+Alpha Disclaimer: the --prune functionality is not yet complete. Do not use unless you are aware of what the current state is. See https://issues.k8s.io/34274.
+Usage
++
$ apply -f FILENAMEFlags
++ +
++ + + +Name +Shorthand +Default +Usage ++ +all ++ false +Select all resources in the namespace of the specified resource types. ++ +cascade ++ true +If true, cascade the deletion of the resources managed by this resource (e.g. Pods created by a ReplicationController). Default true. ++ +dry-run ++ false +If true, only print the object that would be sent, without sending it. ++ +filename +f +[] +that contains the configuration to apply ++ +force ++ false +Only used when grace-period=0. If true, immediately remove resources from API and bypass graceful deletion. Note that immediate deletion of some resources may result in inconsistency or data loss and requires confirmation. ++ +grace-period ++ -1 +Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. Set to 1 for immediate shutdown. Can only be set to 0 when --force is true (force deletion). ++ +include-uninitialized ++ false +If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., "--all". Objects with empty metadata.initializers are regarded as initialized. ++ +openapi-patch ++ true +If true, use openapi to calculate diff when the openapi presents and the resource can be found in the openapi spec. Otherwise, fall back to use baked-in types. ++ +output +o ++ Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. ++ +overwrite ++ true +Automatically resolve conflicts between the modified and live configuration by using values from the modified configuration ++ +prune ++ false +Automatically delete resource objects, including the uninitialized ones, that do not appear in the configs and are created by either apply or create --save-config. Should be used with either -l or --all. ++ +prune-whitelist ++ [] +Overwrite the default whitelist with +for --prune + +record ++ false +Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. ++ +recursive +R +false +Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. ++ +selector +l ++ Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) ++ +timeout ++ 0s +The length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object ++ +validate ++ true +If true, use a schema to validate the input before sending it ++ + +wait ++ false +If true, wait for resources to be gone before returning. This waits for finalizers. +
+edit-last-applied
+++Edit the last-applied-configuration annotations by type/name in YAML.
++kubectl apply edit-last-applied deployment/nginx +++Edit the last-applied-configuration annotations by file in JSON.
++kubectl apply edit-last-applied -f deploy.yaml -o json +Edit the latest last-applied-configuration annotations of resources from the default editor.
+The edit-last-applied command allows you to directly edit any API resource you can retrieve via the command line tools. It will open the editor defined by your KUBE _EDITOR, or EDITOR environment variables, or fall back to 'vi' for Linux or 'notepad' for Windows. You can edit multiple objects, although changes are applied one at a time. The command accepts filenames as well as command line arguments, although the files you point to must be previously saved versions of resources.
+The default format is YAML. To edit in JSON, specify "-o json".
+The flag --windows-line-endings can be used to force Windows line endings, otherwise the default for your operating system will be used.
+In the event an error occurs while updating, a temporary file will be created on disk that contains your unapplied changes. The most common error when updating a resource is another editor changing the resource on the server. When this occurs, you will have to apply your changes to the newer version of the resource, or update your temporary saved copy to include the latest resource version.
+Usage
++
$ edit-last-applied (RESOURCE/NAME | -f FILENAME)Flags
++ +
++ + + +Name +Shorthand +Default +Usage ++ +filename +f +[] +Filename, directory, or URL to files to use to edit the resource ++ +include-uninitialized ++ false +If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., "--all". Objects with empty metadata.initializers are regarded as initialized. ++ +output +o +yaml +Output format. One of: yaml|json. ++ +record ++ false +Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. ++ +recursive +R +false +Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. ++ + +windows-line-endings ++ false +Defaults to the line ending native to your platform. +
+set-last-applied
+++Set the last-applied-configuration of a resource to match the contents of a file.
++kubectl apply set-last-applied -f deploy.yaml +++Execute set-last-applied against each configuration file in a directory.
++kubectl apply set-last-applied -f path/ +++Set the last-applied-configuration of a resource to match the contents of a file, will create the annotation if it does not already exist.
++kubectl apply set-last-applied -f deploy.yaml --create-annotation=true +Set the latest last-applied-configuration annotations by setting it to match the contents of a file. This results in the last-applied-configuration being updated as though 'kubectl apply -f
+' was run, without updating any other parts of the object. Usage
++
$ set-last-applied -f FILENAMEFlags
++ +
++ + + +Name +Shorthand +Default +Usage ++ +create-annotation ++ false +Will create 'last-applied-configuration' annotations if current objects doesn't have one ++ +dry-run ++ false +If true, only print the object that would be sent, without sending it. ++ +filename +f +[] +Filename, directory, or URL to files that contains the last-applied-configuration annotations ++ + +output +o ++ Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. +
+view-last-applied
+++View the last-applied-configuration annotations by type/name in YAML.
++kubectl apply view-last-applied deployment/nginx +++View the last-applied-configuration annotations by file in JSON
++kubectl apply view-last-applied -f deploy.yaml -o json +View the latest last-applied-configuration annotations by type/name or file.
+The default output will be printed to stdout in YAML format. One can use -o option to change output format.
+Usage
++
$ view-last-applied (TYPE [NAME | -l label] | TYPE/NAME | -f FILENAME)Flags
++ +
++ + + +Name +Shorthand +Default +Usage ++ +all ++ false +Select all resources in the namespace of the specified resource types ++ +filename +f +[] +Filename, directory, or URL to files that contains the last-applied-configuration annotations ++ +output +o +yaml +Output format. Must be one of yaml|json ++ +recursive +R +false +Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. ++ + +selector +l ++ Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) +
+annotate
+++Update pod 'foo' with the annotation 'description' and the value 'my frontend'. # If the same annotation is set multiple times, only the last value will be applied
++kubectl annotate pods foo description='my frontend' +++Update a pod identified by type and name in "pod.json"
++kubectl annotate -f pod.json description='my frontend' +++Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value.
++kubectl annotate --overwrite pods foo description='my frontend running nginx' +++Update all pods in the namespace
++kubectl annotate pods --all description='my frontend running nginx' +++Update pod 'foo' only if the resource is unchanged from version 1.
++kubectl annotate pods foo description='my frontend running nginx' --resource-version=1 +++Update pod 'foo' by removing an annotation named 'description' if it exists. # Does not require the --overwrite flag.
++kubectl annotate pods foo description- +Update the annotations on one or more resources
+All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary string values such as structured JSON. Tools and system extensions may use annotations to store their own data.
+Attempting to set an annotation that already exists will fail unless --overwrite is set. If --resource-version is specified and does not match the current resource version on the server the command will fail.
+Use "kubectl api-resources" for a complete list of supported resources.
+Usage
++
$ annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]Flags
++ +
++ + + +Name +Shorthand +Default +Usage ++ +all ++ false +Select all resources, including uninitialized ones, in the namespace of the specified resource types. ++ +dry-run ++ false +If true, only print the object that would be sent, without sending it. ++ +field-selector ++ + Selector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type. ++ +filename +f +[] +Filename, directory, or URL to files identifying the resource to update the annotation ++ +include-uninitialized ++ false +If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., "--all". Objects with empty metadata.initializers are regarded as initialized. ++ +local ++ false +If true, annotation will NOT contact api-server but run locally. ++ +output +o ++ Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. ++ +overwrite ++ false +If true, allow annotations to be overwritten, otherwise reject annotation updates that overwrite existing annotations. ++ +record ++ false +Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. ++ +recursive +R +false +Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. ++ +resource-version ++ + If non-empty, the annotation update will only succeed if this is the current resource-version for the object. Only valid when specifying a single resource. ++ + +selector +l ++ Selector (label query) to filter on, not including uninitialized ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). +
+autoscale
+++Auto scale a deployment "foo", with the number of pods between 2 and 10, no target CPU utilization specified so a default autoscaling policy will be used:
++kubectl autoscale deployment foo --min=2 --max=10 +++Auto scale a replication controller "foo", with the number of pods between 1 and 5, target CPU utilization at 80%:
++kubectl autoscale rc foo --max=5 --cpu-percent=80 +Creates an autoscaler that automatically chooses and sets the number of pods that run in a kubernetes cluster.
+Looks up a Deployment, ReplicaSet, or ReplicationController by name and creates an autoscaler that uses the given resource as a reference. An autoscaler can automatically increase or decrease number of pods deployed within the system as needed.
+Usage
++
$ autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU]Flags
++ +
++ + + +Name +Shorthand +Default +Usage ++ +cpu-percent ++ -1 +The target average CPU utilization (represented as a percent of requested CPU) over all the pods. If it's not specified or negative, a default autoscaling policy will be used. ++ +dry-run ++ false +If true, only print the object that would be sent, without sending it. ++ +filename +f +[] +Filename, directory, or URL to files identifying the resource to autoscale. ++ +generator ++ horizontalpodautoscaler/v1 +The name of the API generator to use. Currently there is only 1 generator. ++ +max ++ -1 +The upper limit for the number of pods that can be set by the autoscaler. Required. ++ +min ++ -1 +The lower limit for the number of pods that can be set by the autoscaler. If it's not specified or negative, the server will apply a default value. ++ +name ++ + The name for the newly created object. If not specified, the name of the input resource will be used. ++ +output +o ++ Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. ++ +record ++ false +Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. ++ +recursive +R +false +Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. ++ + +save-config ++ false +If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. +
+convert
+++Convert 'pod.yaml' to latest version and print to stdout.
++kubectl convert -f pod.yaml +++Convert the live state of the resource specified by 'pod.yaml' to the latest version # and print to stdout in JSON format.
++kubectl convert -f pod.yaml --local -o json +++Convert all files under current directory to latest version and create them all.
++kubectl convert -f . | kubectl create -f - +Convert config files between different API versions. Both YAML and JSON formats are accepted.
+The command takes filename, directory, or URL as input, and convert it into format of version specified by --output-version flag. If target version is not specified or not supported, convert to latest version.
+The default output will be printed to stdout in YAML format. One can use -o option to change to output destination.
+Usage
++
$ convert -f FILENAMEFlags
++ +
+ + + +Name +Shorthand +Default +Usage ++ +filename +f +[] +Filename, directory, or URL to files to need to get converted. ++ +local ++ true +If true, convert will NOT try to contact api-server but run locally. ++ +output +o +yaml +Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. ++ +output-version ++ + Output the formatted object with the given group version (for ex: 'extensions/v1beta1').) ++ +recursive +R +false +Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. ++ validate ++ true +If true, use a schema to validate the input before sending it +
@@ -3837,12 +3267,6 @@ viewing your workloads in a Kubernetes cluster.Filename, directory, or URL to files to use to edit the resource - -include-extended-apis -- true -If true, include definitions of new APIs via calls to the API server. [default true] -include-uninitialized false @@ -3851,8 +3275,8 @@ viewing your workloads in a Kubernetes cluster.output o -yaml -Output format. One of: yaml|json. ++ Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. output-patch @@ -3893,262 +3317,6 @@ viewing your workloads in a Kubernetes cluster.
-get
---List all pods in ps output format.
--kubectl get pods ---List all pods in ps output format with more information (such as node name).
--kubectl get pods -o wide ---List a single replication controller with specified NAME in ps output format.
--kubectl get replicationcontroller web ---List a single pod in JSON output format.
--kubectl get -o json pod web-pod-13je7 ---List a pod identified by type and name specified in "pod.yaml" in JSON output format.
--kubectl get -f pod.yaml -o json ---Return only the phase value of the specified pod.
--kubectl get -o template pod/web-pod-13je7 --template={{.status.phase}} ---List all replication controllers and services together in ps output format.
--kubectl get rc,services ---List one or more resources by their type and names.
--kubectl get rc/web service/frontend pods/web-pod-13je7 ---List all resources with different types.
--kubectl get all -Display one or many resources
-Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will only see results in your current namespace unless you pass --all-namespaces.
-Uninitialized objects are not shown unless --include-uninitialized is passed.
-By specifying the output as 'template' and providing a Go template as the value of the --template flag, you can filter the attributes of the fetched resources.
-Valid resource types include:
--
-- all
-- certificatesigningrequests (aka 'csr')
-- clusterrolebindings
-- clusterroles
-- componentstatuses (aka 'cs')
-- configmaps (aka 'cm')
-- controllerrevisions
-- cronjobs
-- customresourcedefinition (aka 'crd')
-- daemonsets (aka 'ds')
-- deployments (aka 'deploy')
-- endpoints (aka 'ep')
-- events (aka 'ev')
-- horizontalpodautoscalers (aka 'hpa')
-- ingresses (aka 'ing')
-- jobs
-- limitranges (aka 'limits')
-- namespaces (aka 'ns')
-- networkpolicies (aka 'netpol')
-- nodes (aka 'no')
-- persistentvolumeclaims (aka 'pvc')
-- persistentvolumes (aka 'pv')
-- poddisruptionbudgets (aka 'pdb')
-- podpreset
-- pods (aka 'po')
-- podsecuritypolicies (aka 'psp')
-- podtemplates
-- replicasets (aka 'rs')
-- replicationcontrollers (aka 'rc')
-- resourcequotas (aka 'quota')
-- rolebindings
-- roles
-- secrets
-- serviceaccounts (aka 'sa')
-- services (aka 'svc')
-- statefulsets (aka 'sts')
-- storageclasses (aka 'sc')
-Usage
--
$ get [(-o|--output=)json|yaml|wide|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=...] (TYPE [NAME | -l label] | TYPE/NAME ...) [flags]Flags
-- -
-- - - -Name -Shorthand -Default -Usage -- -all-namespaces -- false -If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace. -- -allow-missing-template-keys -- true -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. -- -chunk-size -- 500 -Return large lists in chunks rather than all at once. Pass 0 to disable. This flag is beta and may change in the future. -- -experimental-server-print -- false -If true, have the server return the appropriate table output. Supports extension APIs and CRD. Experimental. -- -export -- false -If true, use 'export' for the resources. Exported resources are stripped of cluster-specific information. -- -field-selector -- - Selector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type. -- -filename -f -[] -Filename, directory, or URL to files identifying the resource to get from a server. -- -ignore-not-found -- false -If the requested object does not exist the command will return exit code 0. -- -include-extended-apis -- true -If true, include definitions of new APIs via calls to the API server. [default true] -- -include-uninitialized -- false -If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., "--all". Objects with empty metadata.initializers are regarded as initialized. -- -label-columns -L -[] -Accepts a comma separated list of labels that are going to be presented as columns. Names are case-sensitive. You can also use multiple flag options like -L label1 -L label2... -- -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -- -output -o -- Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. -- -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -- -raw -- - Raw URI to request from the server. Uses the transport specified by the kubeconfig file. -- -recursive -R -false -Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. -- -selector -l -- Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) -- -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-kind -- false -If present, list the resource type for the requested object(s). -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -- -template -- - 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]. -- -use-openapi-print-columns -- true -If true, use x-kubernetes-print-column metadata (if present) from the OpenAPI schema for displaying a resource. -- -watch -w -false -After listing/getting the requested object, watch for changes. Uninitialized objects are excluded if no object name is provided. -- - -watch-only -- false -Watch for changes to the requested object(s), without listing/getting first. -
label
Update pod 'foo' with the label 'unhealthy' and the value 'true'.
@@ -4207,30 +3375,24 @@ viewing your workloads in a Kubernetes cluster.Select all resources, including uninitialized ones, in the namespace of the specified resource types - -allow-missing-template-keys -- true -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. -dry-run false If true, only print the object that would be sent, without sending it. + +field-selector ++ + Selector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type. +filename f [] Filename, directory, or URL to files identifying the resource to update the labels - -include-extended-apis -- true -If true, include definitions of new APIs via calls to the API server. [default true] -include-uninitialized false @@ -4249,24 +3411,12 @@ viewing your workloads in a Kubernetes cluster.If true, label will NOT contact api-server but run locally. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -- overwrite false @@ -4296,30 +3446,6 @@ viewing your workloads in a Kubernetes cluster.Selector (label query) to filter on, not including uninitialized ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -- template -- - 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]. -
@@ -4366,10 +3492,10 @@ viewing your workloads in a Kubernetes cluster.- allow-missing-template-keys +dry-run - true -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. +false +If true, only print the object that would be sent, without sending it. filename @@ -4378,36 +3504,18 @@ viewing your workloads in a Kubernetes cluster.Filename, directory, or URL to files identifying the resource to update - -include-extended-apis -- true -If true, include definitions of new APIs via calls to the API server. [default true] -local false If true, patch will operate on the content of the file, not the server-side resource. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -patch p @@ -4426,30 +3534,6 @@ viewing your workloads in a Kubernetes cluster. Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -- -template -- - 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]. -type strategic @@ -4499,44 +3583,32 @@ viewing your workloads in a Kubernetes cluster.cascade - false -Only relevant during a force replace. If true, cascade the deletion of the resources managed by this resource (e.g. Pods created by a ReplicationController). +true +If true, cascade the deletion of the resources managed by this resource (e.g. Pods created by a ReplicationController). Default true. filename f [] -Filename, directory, or URL to files to use to replace the resource. +to use to replace the resource. force false -Delete and re-create the specified resource +Only used when grace-period=0. If true, immediately remove resources from API and bypass graceful deletion. Note that immediate deletion of some resources may result in inconsistency or data loss and requires confirmation. - grace-period -1 -Only relevant during a force replace. Period of time in seconds given to the old resource to terminate gracefully. Ignored if negative. -- include-extended-apis -- true -If true, include definitions of new APIs via calls to the API server. [default true] +Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. Set to 1 for immediate shutdown. Can only be set to 0 when --force is true (force deletion). - output o - Output mode. Use "-o name" for shorter output (resource/name). -- record -- false -Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. +Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. recursive @@ -4554,7 +3626,7 @@ viewing your workloads in a Kubernetes cluster.timeout 0s -Only relevant during a force replace. The length of time to wait before giving up on a delete of the old resource, zero means determine a timeout from the size of the object. Any other values should contain a corresponding time unit (e.g. 1s, 2m, 3h). +The length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object - - - validate @@ -4562,170 +3634,11 @@ viewing your workloads in a Kubernetes cluster.true If true, use a schema to validate the input before sending it
-rolling-update
---Update pods of frontend-v1 using new replication controller data in frontend-v2.json.
--kubectl rolling-update frontend-v1 -f frontend-v2.json ---Update pods of frontend-v1 using JSON data passed into stdin.
--cat frontend-v2.json | kubectl rolling-update frontend-v1 -f - ---Update the pods of frontend-v1 to frontend-v2 by just changing the image, and switching the # name of the replication controller.
--kubectl rolling-update frontend-v1 frontend-v2 --image=image:v2 ---Update the pods of frontend by just changing the image, and keeping the old name.
--kubectl rolling-update frontend --image=image:v2 ---Abort and reverse an existing rollout in progress (from frontend-v1 to frontend-v2).
--kubectl rolling-update frontend-v1 frontend-v2 --rollback -Perform a rolling update of the given ReplicationController.
-Replaces the specified replication controller with a new replication controller by updating one pod at a time to use the new PodTemplate. The new-controller.json must specify the same namespace as the existing replication controller and overwrite at least one (common) label in its replicaSelector.
-! http://kubernetes.io/images/docs/kubectl_rollingupdate.svg
-Usage
--
$ rolling-update OLD_CONTROLLER_NAME ([NEW_CONTROLLER_NAME] --image=NEW_CONTAINER_IMAGE | -f NEW_CONTROLLER_SPEC)Flags
--
@@ -5035,16 +3948,10 @@ viewing your workloads in a Kubernetes cluster.- - - -Name -Shorthand -Default -Usage -- -allow-missing-template-keys -- true -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. -- -container -- - Container name which will have its image upgraded. Only relevant when --image is specified, ignored otherwise. Required when using --image on a multi-container pod -- -deployment-label-key -- deployment -The key to use to differentiate between two different controllers, default 'deployment'. Only relevant when --image is specified, ignored otherwise -- -dry-run +wait false -If true, only print the object that would be sent, without sending it. -- -filename -f -[] -Filename or URL to file to use to create the new replication controller. -- -image -- - Image to use for upgrading the replication controller. Must be distinct from the existing image (either new image or new image tag). Can not be used with --filename/-f -- -image-pull-policy -- - Explicit policy for when to pull container images. Required when --image is same as existing image, ignored otherwise. -- -include-extended-apis -- true -If true, include definitions of new APIs via calls to the API server. [default true] -- -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -- -output -o -- Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. -- -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -- -poll-interval -- 3s -Time delay between polling for replication controller status after the update. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". -- -rollback -- false -If true, this is a request to abort an existing rollout that is partially rolled out. It effectively reverses current and next and runs a rollout -- -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -- -template -- - 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]. -- -timeout -- 5m0s -Max time to wait for a replication controller to update before giving up. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". -- -update-period -- 1m0s -Time to wait between updating pods. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". -- validate -- true -If true, use a schema to validate the input before sending it +If true, wait for resources to be gone before returning. This waits for finalizers. Filename, directory, or URL to files identifying the resource to set a new size - -include-extended-apis -- true -If true, include definitions of new APIs via calls to the API server. [default true] -output o - Output mode. Use "-o name" for shorter output (resource/name). +Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. record @@ -5061,7 +3968,7 @@ viewing your workloads in a Kubernetes cluster.replicas - -1 +0 The new desired number of replicas. Required. @@ -5128,6 +4035,11 @@ viewing your workloads in a Kubernetes cluster. kubectl set env --from=configmap/myconfigmap --prefix=MYSQL_ deployment/myapp++Import specific keys from a config map
++kubectl set env --keys=my-example-key --from=configmap/myconfigmap deployment/myapp +Remove the environment variable ENV from container 'c1' in all deployment configs
kubectl set env deployments --all --containers="c1" ENV- @@ -5167,12 +4079,6 @@ viewing your workloads in a Kubernetes cluster.If true, select all resources in the namespace of the specified resource types - -allow-missing-template-keys -- true -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. -containers c * @@ -5203,6 +4109,12 @@ viewing your workloads in a Kubernetes cluster.The name of a resource from which to inject environment variables + +keys ++ [] +Comma-separated list of keys to import from specified resource +list false @@ -5215,24 +4127,12 @@ viewing your workloads in a Kubernetes cluster.If true, set env will NOT contact api-server but run locally. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -- overwrite true @@ -5262,30 +4162,6 @@ viewing your workloads in a Kubernetes cluster.Selector (label query) to filter on - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -- template -- - 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]. -
@@ -5333,12 +4209,6 @@ viewing your workloads in a Kubernetes cluster.Select all resources, including uninitialized ones, in the namespace of the specified resource types - -allow-missing-template-keys -- true -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. -dry-run false @@ -5363,24 +4233,12 @@ viewing your workloads in a Kubernetes cluster.If true, set image will NOT contact api-server but run locally. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -- record false @@ -5398,30 +4256,6 @@ viewing your workloads in a Kubernetes cluster.Selector (label query) to filter on, not including uninitialized ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -- template -- - 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]. -
@@ -5448,7 +4282,7 @@ viewing your workloads in a Kubernetes cluster.Specify compute resource requirements (cpu, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to its specified limits.
for each compute resource, if a limit is specified and a request is omitted, the request will default to the limit.
-Possible resources include (case insensitive): replicationcontroller, deployment, daemonset, job, replicaset.
+Possible resources include (case insensitive): Use "kubectl api-resources" for a complete list of supported resources..
Usage
$ resources (-f FILENAME | TYPE NAME) ([--limits=LIMITS & --requests=REQUESTS]Flags
@@ -5469,12 +4303,6 @@ viewing your workloads in a Kubernetes cluster.Select all resources, including uninitialized ones, in the namespace of the specified resource types - -allow-missing-template-keys -- true -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. -containers c * @@ -5511,24 +4339,12 @@ viewing your workloads in a Kubernetes cluster.If true, set resources will NOT contact api-server but run locally. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -- record false @@ -5552,30 +4368,6 @@ viewing your workloads in a Kubernetes cluster.Selector (label query) to filter on, not including uninitialized ones,supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -- template -- - 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]. -
@@ -5605,13 +4397,7 @@ viewing your workloads in a Kubernetes cluster.all false -Select all resources, including uninitialized ones, in the namespace of the specified resource types - -- allow-missing-template-keys -- true -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. +Select all resources in the namespace of the specified resource types dry-run @@ -5623,7 +4409,7 @@ viewing your workloads in a Kubernetes cluster.filename f [] -Filename, directory, or URL to files the resource to update the selectors +identifying the resource. - include-uninitialized @@ -5635,13 +4421,7 @@ viewing your workloads in a Kubernetes cluster.local false -If true, set selector will NOT contact api-server but run locally. -- no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). +If true, annotation will NOT contact api-server but run locally. output @@ -5650,12 +4430,6 @@ viewing your workloads in a Kubernetes cluster.Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -record false @@ -5664,7 +4438,7 @@ viewing your workloads in a Kubernetes cluster.recursive R -false +true Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. @@ -5673,30 +4447,6 @@ viewing your workloads in a Kubernetes cluster. -If non-empty, the selectors update will only succeed if this is the current resource-version for the object. Only valid when specifying a single resource. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -- template -- - 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]. -
@@ -5734,12 +4484,6 @@ viewing your workloads in a Kubernetes cluster.Select all resources, including uninitialized ones, in the namespace of the specified resource types - -allow-missing-template-keys -- true -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. -dry-run false @@ -5764,24 +4508,12 @@ viewing your workloads in a Kubernetes cluster.If true, set serviceaccount will NOT contact api-server but run locally. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -- record false @@ -5793,30 +4525,6 @@ viewing your workloads in a Kubernetes cluster.false Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -- template -- - 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]. -
@@ -5857,12 +4565,6 @@ viewing your workloads in a Kubernetes cluster.Select all resources, including uninitialized ones, in the namespace of the specified resource types - -allow-missing-template-keys -- true -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. -dry-run false @@ -5893,24 +4595,12 @@ viewing your workloads in a Kubernetes cluster.If true, set subject will NOT contact api-server but run locally. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -- recursive R false @@ -5928,60 +4618,12 @@ viewing your workloads in a Kubernetes cluster.[] Service accounts to bind to the role - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -- -template -- - 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]. -DECLARATIVE APP MANAGEMENT
-apply
---Apply the configuration in pod.json to a pod.
--kubectl apply -f ./pod.json ---Apply the JSON passed into stdin to a pod.
--cat pod.json | kubectl apply -f - ---Note: --prune is still in Alpha # Apply the configuration in manifest.yaml that matches label app=nginx and delete all the other resources that are not in the file and match label app=nginx.
--kubectl apply --prune -f manifest.yaml -l app=nginx ---Apply the configuration in manifest.yaml and delete all the other configmaps that are not in the file.
--kubectl apply --prune -f manifest.yaml --all --prune-whitelist=core/v1/ConfigMap -Apply a configuration to a resource by filename or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initially with either 'apply' or 'create --save-config'.
-JSON and YAML formats are accepted.
-Alpha Disclaimer: the --prune functionality is not yet complete. Do not use unless you are aware of what the current state is. See https://issues.k8s.io/34274.
+wait
Usage
-+
$ apply -f FILENAME
$ wait resource.group/name [--for=delete|--for condition=available]Flags
@@ -5994,70 +4636,22 @@ viewing your workloads in a Kubernetes cluster.
-- -all +all-namespaces false -Select all resources in the namespace of the specified resource types. -- -allow-missing-template-keys -- true -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. -- -cascade -- true -Only relevant during a prune or a force apply. If true, cascade the deletion of the resources managed by pruned or deleted resources (e.g. Pods created by a ReplicationController). -- dry-run -- false -If true, only print the object that would be sent, without sending it. +If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace. filename f [] -Filename, directory, or URL to files that contains the configuration to apply +identifying the resource. - -force +for - false -Delete and re-create the specified resource, when PATCH encounters conflict and has retried for 5 times. -- -grace-period - -1 -Only relevant during a prune or a force apply. Period of time in seconds given to pruned or deleted resources to terminate gracefully. Ignored if negative. -- -include-extended-apis -- true -If true, include definitions of new APIs via calls to the API server. [default true] -- -include-uninitialized -- false -If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., "--all". Objects with empty metadata.initializers are regarded as initialized. -- -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -- openapi-patch -- true -If true, use openapi to calculate diff when the openapi presents and the resource can be found in the openapi spec. Otherwise, fall back to use baked-in types. +The condition to wait on: [delete|condition=condition-name]. output @@ -6066,39 +4660,9 @@ viewing your workloads in a Kubernetes cluster.Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -- -overwrite -- true -Automatically resolve conflicts between the modified and live configuration by using values from the modified configuration -- -prune -- false -Automatically delete resource objects, including the uninitialized ones, that do not appear in the configs and are created by either apply or create --save-config. Should be used with either -l or --all. -- -prune-whitelist -- [] -Overwrite the default whitelist with -for --prune - -record -- false -Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. -recursive R -false +true Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. @@ -6108,272 +4672,10 @@ viewing your workloads in a Kubernetes cluster. Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -- -template -- - 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]. -- timeout - 0s -Only relevant during a force apply. The length of time to wait before giving up on a delete of the old resource, zero means determine a timeout from the size of the object. Any other values should contain a corresponding time unit (e.g. 1s, 2m, 3h). -- - -validate -- true -If true, use a schema to validate the input before sending it -
-edit-last-applied
---Edit the last-applied-configuration annotations by type/name in YAML.
--kubectl apply edit-last-applied deployment/nginx ---Edit the last-applied-configuration annotations by file in JSON.
--kubectl apply edit-last-applied -f deploy.yaml -o json -Edit the latest last-applied-configuration annotations of resources from the default editor.
-The edit-last-applied command allows you to directly edit any API resource you can retrieve via the command line tools. It will open the editor defined by your KUBE _EDITOR, or EDITOR environment variables, or fall back to 'vi' for Linux or 'notepad' for Windows. You can edit multiple objects, although changes are applied one at a time. The command accepts filenames as well as command line arguments, although the files you point to must be previously saved versions of resources.
-The default format is YAML. To edit in JSON, specify "-o json".
-The flag --windows-line-endings can be used to force Windows line endings, otherwise the default for your operating system will be used.
-In the event an error occurs while updating, a temporary file will be created on disk that contains your unapplied changes. The most common error when updating a resource is another editor changing the resource on the server. When this occurs, you will have to apply your changes to the newer version of the resource, or update your temporary saved copy to include the latest resource version.
-Usage
--
$ edit-last-applied (RESOURCE/NAME | -f FILENAME)Flags
-- -
-- - - -Name -Shorthand -Default -Usage -- -filename -f -[] -Filename, directory, or URL to files to use to edit the resource -- -include-uninitialized -- false -If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., "--all". Objects with empty metadata.initializers are regarded as initialized. -- -output -o -yaml -Output format. One of: yaml|json. -- -record -- false -Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. -- -recursive -R -false -Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. -- - -windows-line-endings -- false -Defaults to the line ending native to your platform. -
-set-last-applied
---Set the last-applied-configuration of a resource to match the contents of a file.
--kubectl apply set-last-applied -f deploy.yaml ---Execute set-last-applied against each configuration file in a directory.
--kubectl apply set-last-applied -f path/ ---Set the last-applied-configuration of a resource to match the contents of a file, will create the annotation if it does not already exist.
--kubectl apply set-last-applied -f deploy.yaml --create-annotation=true -Set the latest last-applied-configuration annotations by setting it to match the contents of a file. This results in the last-applied-configuration being updated as though 'kubectl apply -f
-' was run, without updating any other parts of the object. Usage
--
$ set-last-applied -f FILENAMEFlags
-- -
-- - - -Name -Shorthand -Default -Usage -- -allow-missing-template-keys -- true -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. -- -create-annotation -- false -Will create 'last-applied-configuration' annotations if current objects doesn't have one -- -dry-run -- false -If true, only print the object that would be sent, without sending it. -- -filename -f -[] -Filename, directory, or URL to files that contains the last-applied-configuration annotations -- -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -- -output -o -- Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. -- -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -- -record -- false -Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. -- -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -- - -template -- - 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]. -
-view-last-applied
---View the last-applied-configuration annotations by type/name in YAML.
--kubectl apply view-last-applied deployment/nginx ---View the last-applied-configuration annotations by file in JSON
--kubectl apply view-last-applied -f deploy.yaml -o json -View the latest last-applied-configuration annotations by type/name or file.
-The default output will be printed to stdout in YAML format. One can use -o option to change output format.
-Usage
--
$ view-last-applied (TYPE [NAME | -l label] | TYPE/NAME | -f FILENAME)Flags
-- -
@@ -6542,10 +4844,10 @@ applications.- - - -Name -Shorthand -Default -Usage -- -all -- false -Select all resources in the namespace of the specified resource types -- -filename -f -[] -Filename, directory, or URL to files that contains the last-applied-configuration annotations -- -output -o -- Output format. Must be one of yaml|json -- -recursive -R -false -Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. -- selector -l -- Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) +30s +The length of time to wait before giving up. Zero means check once and don't wait, negative means wait for a week. - allow-missing-template-keys +dry-run - true -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. +false +If true, display results but do not submit changes filename @@ -6554,53 +4856,17 @@ applications.Filename, directory, or URL to files identifying the resource to reconcile. - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -- recursive R false Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -- template -- - 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]. -
@@ -6683,46 +4949,7 @@ applications.Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all objects of that type, provide a name prefix, or label selector. For example:
$ kubectl describe TYPE NAME_PREFIX
will first check for an exact match on TYPE and NAME PREFIX. If no such resource exists, it will output details for every resource that has a name prefixed with NAME PREFIX.
-Valid resource types include:
--
+- all
-- certificatesigningrequests (aka 'csr')
-- clusterrolebindings
-- clusterroles
-- componentstatuses (aka 'cs')
-- configmaps (aka 'cm')
-- controllerrevisions
-- cronjobs
-- customresourcedefinition (aka 'crd')
-- daemonsets (aka 'ds')
-- deployments (aka 'deploy')
-- endpoints (aka 'ep')
-- events (aka 'ev')
-- horizontalpodautoscalers (aka 'hpa')
-- ingresses (aka 'ing')
-- jobs
-- limitranges (aka 'limits')
-- namespaces (aka 'ns')
-- networkpolicies (aka 'netpol')
-- nodes (aka 'no')
-- persistentvolumeclaims (aka 'pvc')
-- persistentvolumes (aka 'pv')
-- poddisruptionbudgets (aka 'pdb')
-- podpreset
-- pods (aka 'po')
-- podsecuritypolicies (aka 'psp')
-- podtemplates
-- replicasets (aka 'rs')
-- replicationcontrollers (aka 'rc')
-- resourcequotas (aka 'quota')
-- rolebindings
-- roles
-- secrets
-- serviceaccounts (aka 'sa')
-- services (aka 'svc')
-- statefulsets (aka 'sts')
-- storageclasses (aka 'sc')
-Use "kubectl api-resources" for a complete list of supported resources.
Usage
$ describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)Flags
@@ -6749,12 +4976,6 @@ applications.Filename, directory, or URL to files containing the resource to describe - -include-extended-apis -- true -If true, include definitions of new APIs via calls to the API server. [default true] -+ include-uninitialized false @@ -6850,9 +5071,14 @@ applications.kubectl logs nginx--Return snapshot logs for the pods defined by label app=nginx
+Return snapshot logs from pod nginx with multi containers
kubectl logs -lapp=nginx ++kubectl logs nginx --all-containers=true +++Return snapshot logs from all containers in pods defined by label app=nginx
+kubectl logs -lapp=nginx --all-containers=trueReturn snapshot of previous terminated ruby container logs from pod web-1
@@ -6899,6 +5125,12 @@ applications.+ +all-containers ++ false +Get all containers's logs in the pod(s). +container c @@ -6911,12 +5143,6 @@ applications. Specify if the logs should be streamed. - -include-extended-apis -- true -If true, include definitions of new APIs via calls to the API server. [default true] -interactive false @@ -7321,10 +5547,16 @@ applications.Filename, directory, or URL to files identifying the resource to update + +force ++ false +Update the CSR even if it is already approved. +output o - Output mode. Use "-o name" for shorter output (resource/name). +Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. recursive @@ -7358,10 +5590,16 @@ applications.Filename, directory, or URL to files identifying the resource to update + +force ++ false +Update the CSR even if it is already denied. +output o - Output mode. Use "-o name" for shorter output (resource/name). +Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. recursive @@ -7381,25 +5619,6 @@ applications.Display addresses of the master and services with label kubernetes.io/cluster-service=true To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
Usage
-
$ cluster-infoFlags
-- -
- - - -Name -Shorthand -Default -Usage -- - -include-extended-apis -- true -If true, include definitions of new APIs via calls to the API server. [default true] -
dump
@@ -7629,36 +5848,12 @@ applications.Select all nodes in the cluster - -allow-missing-template-keys -- true -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. -- -include-extended-apis -- true -If true, include definitions of new APIs via calls to the API server. [default true] -- -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. - -output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). -overwrite false @@ -7671,30 +5866,6 @@ applications.Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -- -template -- - 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]. -validate true @@ -7792,6 +5963,85 @@ applications.
+api-resources
+++Print the supported API Resources
++kubectl api-resources +++Print the supported API Resources with more information
++kubectl api-resources -o wide +++Print the supported namespaced resources
++kubectl api-resources --namespaced=true +++Print the supported non-namespaced resources
++kubectl api-resources --namespaced=false +++Print the supported API Resources with specific APIGroup
++kubectl api-resources --api-group=extensions +Print the supported API resources on the server
+Usage
++
$ api-resourcesFlags
++ +
++ + + +Name +Shorthand +Default +Usage ++ +api-group ++ + Limit to resources in the specified API group. ++ +cached ++ false +Use the cached list of resources if available. ++ +namespaced ++ true +If false, non-namespaced resources will be returned, otherwise returning namespaced resources by default. ++ +no-headers ++ false +When using the default or custom-column output format, don't print headers (default print headers). ++ +output +o ++ Output format. One of: wide|name. ++ + +verbs ++ [] +Limit to resources that support the specified verbs. +
completion
Installing bash completion on macOS using homebrew ## If running Bash 3.2 included with macOS
@@ -7919,12 +6169,6 @@ source $HOME/.bash_profile- -allow-missing-template-keys -- true -If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. -@@ -8100,6 +6344,18 @@ source $HOME/.bash_profile no-headers false @@ -7934,7 +6178,7 @@ source $HOME/.bash_profileoutput o - Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. +Output format. One of: name false Embed client cert/key for the user entry in kubeconfig + +password ++ + password for the user entry in kubeconfig ++ username ++ + username for the user entry in kubeconfig +
@@ -8131,11 +6387,16 @@ source $HOME/.bash_profile
view
-Show Merged kubeconfig settings.
+Show merged kubeconfig settings.
kubectl config view++Show merged kubeconfig settings and raw certificate data.
++kubectl config view --raw +Get the password for the e2e user
kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}' @@ -8180,22 +6441,10 @@ source $HOME/.bash_profileRemove all information not used by current-context from the output - -no-headers -- false -When using the default or custom-column output format, don't print headers (default print headers). -- output o -- Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. -- output-version -- - DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob'). +yaml +Output format. One of: json|yaml|name|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. raw @@ -8204,24 +6453,6 @@ source $HOME/.bash_profileDisplay raw byte data - -show-all -a -true -When printing, show all resources (default show all pods including terminated one.) -- -show-labels -- false -When printing, show all labels as the last column (default hide labels column) -- -sort-by -- - 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. -template @@ -8245,46 +6476,7 @@ source $HOME/.bash_profile This command describes the fields associated with each supported API resource. Fields are identified via a simple JSONPath identifier:
. [. ] Add the --recursive flag to display all of the fields at once without descriptions. Information about each field is retrieved from the server in OpenAPI format.
-Valid resource types include:
--
+- all
-- certificatesigningrequests (aka 'csr')
-- clusterrolebindings
-- clusterroles
-- componentstatuses (aka 'cs')
-- configmaps (aka 'cm')
-- controllerrevisions
-- cronjobs
-- customresourcedefinition (aka 'crd')
-- daemonsets (aka 'ds')
-- deployments (aka 'deploy')
-- endpoints (aka 'ep')
-- events (aka 'ev')
-- horizontalpodautoscalers (aka 'hpa')
-- ingresses (aka 'ing')
-- jobs
-- limitranges (aka 'limits')
-- namespaces (aka 'ns')
-- networkpolicies (aka 'netpol')
-- nodes (aka 'no')
-- persistentvolumeclaims (aka 'pvc')
-- persistentvolumes (aka 'pv')
-- poddisruptionbudgets (aka 'pdb')
-- podpreset
-- pods (aka 'po')
-- podsecuritypolicies (aka 'psp')
-- podtemplates
-- replicasets (aka 'rs')
-- replicationcontrollers (aka 'rc')
-- resourcequotas (aka 'quota')
-- rolebindings
-- roles
-- secrets
-- serviceaccounts (aka 'sa')
-- services (aka 'svc')
-- statefulsets (aka 'sts')
-- storageclasses (aka 'sc')
-Use "kubectl api-resources" for a complete list of supported resources.
Usage
$ explain RESOURCEFlags
@@ -8305,12 +6497,6 @@ source $HOME/.bash_profileGet different explanations for particular API version - -include-extended-apis -- true -If true, include definitions of new APIs via calls to the API server. [default true] -- recursive false @@ -8329,6 +6515,12 @@ source $HOME/.bash_profileUsage
$ options
+plugin
+Runs a command-line plugin.
+Plugins are subcommands that are not part of the major command-line distribution and can even be provided by third-parties. Please refer to the documentation and examples for more information about how to install and write your own plugins.
+Usage
++
$ plugin NAME
version
Print the client and server versions for the current context
@@ -8369,13 +6561,419 @@ source $HOME/.bash_profile
-plugin
-Runs a command-line plugin.
-Plugins are subcommands that are not part of the major command-line distribution and can even be provided by third-parties. Please refer to the documentation and examples for more information about how to install and write your own plugins.
-Usage
-
$ plugin NAMEDEPRECATED COMMANDS
+
+rolling-update
+++Update pods of frontend-v1 using new replication controller data in frontend-v2.json.
++kubectl rolling-update frontend-v1 -f frontend-v2.json +++Update pods of frontend-v1 using JSON data passed into stdin.
++cat frontend-v2.json | kubectl rolling-update frontend-v1 -f - +++Update the pods of frontend-v1 to frontend-v2 by just changing the image, and switching the # name of the replication controller.
++kubectl rolling-update frontend-v1 frontend-v2 --image=image:v2 +++Update the pods of frontend by just changing the image, and keeping the old name.
++kubectl rolling-update frontend --image=image:v2 +++Abort and reverse an existing rollout in progress (from frontend-v1 to frontend-v2).
++kubectl rolling-update frontend-v1 frontend-v2 --rollback +Perform a rolling update of the given ReplicationController.
+Replaces the specified replication controller with a new replication controller by updating one pod at a time to use the new PodTemplate. The new-controller.json must specify the same namespace as the existing replication controller and overwrite at least one (common) label in its replicaSelector.
+! http://kubernetes.io/images/docs/kubectl_rollingupdate.svg
+Usage
++
$ rolling-update OLD_CONTROLLER_NAME ([NEW_CONTROLLER_NAME] --image=NEW_CONTAINER_IMAGE | -f NEW_CONTROLLER_SPEC)Flags
++ +
++ + + +Name +Shorthand +Default +Usage ++ +container ++ + Container name which will have its image upgraded. Only relevant when --image is specified, ignored otherwise. Required when using --image on a multi-container pod ++ +deployment-label-key ++ deployment +The key to use to differentiate between two different controllers, default 'deployment'. Only relevant when --image is specified, ignored otherwise ++ +dry-run ++ false +If true, only print the object that would be sent, without sending it. ++ +filename +f +[] +Filename or URL to file to use to create the new replication controller. ++ +image ++ + Image to use for upgrading the replication controller. Must be distinct from the existing image (either new image or new image tag). Can not be used with --filename/-f ++ +image-pull-policy ++ + Explicit policy for when to pull container images. Required when --image is same as existing image, ignored otherwise. ++ +output +o ++ Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. ++ +poll-interval ++ 3s +Time delay between polling for replication controller status after the update. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". ++ +rollback ++ false +If true, this is a request to abort an existing rollout that is partially rolled out. It effectively reverses current and next and runs a rollout ++ +timeout ++ 5m0s +Max time to wait for a replication controller to update before giving up. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". ++ +update-period ++ 1m0s +Time to wait between updating pods. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". ++ + +validate ++ true +If true, use a schema to validate the input before sending it +
+run-container
+++Start a single instance of nginx.
++kubectl run nginx --image=nginx +++Start a single instance of hazelcast and let the container expose port 5701 .
++kubectl run hazelcast --image=hazelcast --port=5701 +++Start a single instance of hazelcast and set environment variables "DNS_DOMAIN=cluster" and "POD_NAMESPACE=default" in the container.
++kubectl run hazelcast --image=hazelcast --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default" +++Start a single instance of hazelcast and set labels "app=hazelcast" and "env=prod" in the container.
++kubectl run hazelcast --image=nginx --labels="app=hazelcast,env=prod" +++Start a replicated instance of nginx.
++kubectl run nginx --image=nginx --replicas=5 +++Dry run. Print the corresponding API objects without creating them.
++kubectl run nginx --image=nginx --dry-run +++Start a single instance of nginx, but overload the spec of the deployment with a partial set of values parsed from JSON.
++kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }' +++Start a pod of busybox and keep it in the foreground, don't restart it if it exits.
++kubectl run -i -t busybox --image=busybox --restart=Never +++Start the nginx container using the default command, but use custom arguments (arg1 .. argN) for that command.
++kubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN> +++Start the nginx container using a different command and custom arguments.
++kubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN> +++Start the perl container to compute π to 2000 places and print it out.
++kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)' +++Start the cron job to compute π to 2000 places and print it out every 5 minutes.
++kubectl run pi --schedule="0/5 * * * ?" --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)' +Create and run a particular image, possibly replicated.
+Creates a deployment or job to manage the created container(s).
+Usage
++
$ run-containerFlags
++ +
+ + + +Name +Shorthand +Default +Usage ++ +attach ++ false +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/--stdin' is set, in which case the default is true. With '--restart=Never' the exit code of the container process is returned. ++ +cascade ++ true +If true, cascade the deletion of the resources managed by this resource (e.g. Pods created by a ReplicationController). Default true. ++ +command ++ false +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. ++ +dry-run ++ false +If true, only print the object that would be sent, without sending it. ++ +env ++ [] +Environment variables to set in the container ++ +expose ++ false +If true, a public, external service is created for the container(s) which are run ++ +filename +f +[] +to use to replace the resource. ++ +force ++ false +Only used when grace-period=0. If true, immediately remove resources from API and bypass graceful deletion. Note that immediate deletion of some resources may result in inconsistency or data loss and requires confirmation. ++ +generator ++ + The name of the API generator to use, see http://kubernetes.io/docs/user-guide/kubectl-conventions/#generators for a list. ++ +grace-period ++ -1 +Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. Set to 1 for immediate shutdown. Can only be set to 0 when --force is true (force deletion). ++ +hostport ++ -1 +The host port mapping for the container port. To demonstrate a single-machine container. ++ +image ++ + The image for the container to run. ++ +image-pull-policy ++ + The image pull policy for the container. If left empty, this value will not be specified by the client and defaulted by the server ++ +labels +l ++ Comma separated labels to apply to the pod(s). Will override previous values. ++ +leave-stdin-open ++ false +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. ++ +limits ++ + The resource requirement limits for this container. For example, 'cpu=200m,memory=512Mi'. Note that server side components may assign limits depending on the server configuration, such as limit ranges. ++ +output +o ++ Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath]. ++ +overrides ++ + 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. ++ +pod-running-timeout ++ 1m0s +The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running ++ +port ++ + The port that this container exposes. If --expose is true, this is also the port used by the service that is created. ++ +quiet ++ false +If true, suppress prompt messages. ++ +record ++ false +Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. ++ +recursive +R +false +Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. ++ +replicas +r +1 +Number of replicas to create for this container. Default is 1. ++ +requests ++ + The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'. Note that server side components may assign requests depending on the server configuration, such as limit ranges. ++ +restart ++ Always +The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a deployment is created, if set to 'OnFailure' a job is created, if set to 'Never', a regular pod is created. For the latter two --replicas must be 1. Default 'Always', for CronJobs +Never.+ +rm ++ false +If true, delete resources created in this command for attached containers. ++ +save-config ++ false +If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. ++ +schedule ++ + A schedule in the Cron format the job should be run with. ++ +service-generator ++ service/v2 +The name of the generator to use for creating a service. Only used if --expose is true ++ +service-overrides ++ + 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. ++ +serviceaccount ++ + Service account to set in the pod spec ++ +stdin +i +false +Keep stdin open on the container(s) in the pod, even if nothing is attached. ++ +timeout ++ 0s +The length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object ++ +tty +t +false +Allocated a TTY for each container in the pod. ++ + +wait ++ false +If true, wait for resources to be gone before returning. This waits for finalizers. +