From a6a5d359e59863ddd08ca84a69e5c8f8f7eb0b48 Mon Sep 17 00:00:00 2001 From: Qiming Teng Date: Sun, 8 Aug 2021 20:49:16 +0800 Subject: [PATCH] Update kubectl reference for 1.22 --- .../generated/kubectl/kubectl-commands.html | 574 ++++++++++-------- 1 file changed, 310 insertions(+), 264 deletions(-) diff --git a/static/docs/reference/generated/kubectl/kubectl-commands.html b/static/docs/reference/generated/kubectl/kubectl-commands.html index 6d1b082c61..06cfbabb1d 100644 --- a/static/docs/reference/generated/kubectl/kubectl-commands.html +++ b/static/docs/reference/generated/kubectl/kubectl-commands.html @@ -28,17 +28,17 @@ inspect them.


create

-

Create a pod using the data in pod.json.

+

Create a pod using the data in pod.json

kubectl create -f ./pod.json
 
-

Create a pod based on the JSON passed into stdin.

+

Create a pod based on the JSON passed into stdin

cat pod.json | kubectl create -f -
 
-

Edit the data in docker-registry.yaml in JSON 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 -o json
 
@@ -158,36 +158,36 @@ inspect them.


clusterrole

-

Create a ClusterRole named "pod-reader" that allows user to perform "get", "watch" and "list" on pods

+

Create a cluster role named "pod-reader" that allows user to perform "get", "watch" and "list" on pods

kubectl create clusterrole pod-reader --verb=get,list,watch --resource=pods
 
-

Create a ClusterRole named "pod-reader" with ResourceName specified

+

Create a cluster role named "pod-reader" with ResourceName specified

kubectl create clusterrole pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod
 
-

Create a ClusterRole named "foo" with API Group specified

+

Create a cluster role named "foo" with API Group specified

kubectl create clusterrole foo --verb=get,list,watch --resource=rs.extensions
 
-

Create a ClusterRole named "foo" with SubResource specified

+

Create a cluster role named "foo" with SubResource specified

kubectl create clusterrole foo --verb=get,list,watch --resource=pods,pods/status
 
-

Create a ClusterRole name "foo" with NonResourceURL specified

+

Create a cluster role name "foo" with NonResourceURL specified

kubectl create clusterrole "foo" --verb=get --non-resource-url=/logs/*
 
-

Create a ClusterRole name "monitoring" with AggregationRule specified

+

Create a cluster role name "monitoring" with AggregationRule specified

kubectl create clusterrole monitoring --aggregation-rule="rbac.example.com/aggregate-to-monitoring=true"
 
-

Create a ClusterRole.

+

Create a cluster role.

Usage

$ kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]

Flags

@@ -284,11 +284,11 @@ inspect them.


clusterrolebinding

-

Create a ClusterRoleBinding for user1, user2, and group1 using the cluster-admin ClusterRole

+

Create a cluster role binding for user1, user2, and group1 using the cluster-admin cluster role

kubectl create clusterrolebinding cluster-admin --clusterrole=cluster-admin --user=user1 --user=user2 --group=group1
 
-

Create a ClusterRoleBinding for a particular ClusterRole.

+

Create a cluster role binding for a particular cluster role.

Usage

$ kubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]

Flags

@@ -373,34 +373,34 @@ inspect them.


configmap

-

Create a new configmap named my-config based on folder bar

+

Create a new config map named my-config based on folder bar

kubectl create configmap my-config --from-file=path/to/bar
 
-

Create a new configmap named my-config with specified keys instead of file basenames on disk

+

Create a new config map named my-config with specified keys instead of file basenames on disk

kubectl create configmap my-config --from-file=key1=/path/to/bar/file1.txt --from-file=key2=/path/to/bar/file2.txt
 
-

Create a new configmap named my-config with key1=config1 and key2=config2

+

Create a new config map named my-config with key1=config1 and key2=config2

kubectl create configmap my-config --from-literal=key1=config1 --from-literal=key2=config2
 
-

Create a new configmap named my-config from the key=value pairs in the file

+

Create a new config map named my-config from the key=value pairs in the file

kubectl create configmap my-config --from-file=path/to/bar
 
-

Create a new configmap named my-config from an env file

+

Create a new config map named my-config from an env file

kubectl create configmap my-config --from-env-file=path/to/bar.env
 
-

Create a configmap based on a file, directory, or specified literal value.

-

A single configmap may package one or more key/value pairs.

-

When creating a configmap based on a file, the key will default to the basename of the file, and the value will default to the file content. If the basename is an invalid key, you may specify an alternate key.

-

When creating a configmap based on a directory, each file whose basename is a valid key in the directory will be packaged into the configmap. Any directory entries except regular files are ignored (e.g. subdirectories, symlinks, devices, pipes, etc).

+

Create a config map based on a file, directory, or specified literal value.

+

A single config map may package one or more key/value pairs.

+

When creating a config map based on a file, the key will default to the basename of the file, and the value will default to the file content. If the basename is an invalid key, you may specify an alternate key.

+

When creating a config map based on a directory, each file whose basename is a valid key in the directory will be packaged into the config map. Any directory entries except regular files are ignored (e.g. subdirectories, symlinks, devices, pipes, etc).

Usage

$ kubectl create configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run=server|client|none]

Flags

@@ -491,16 +491,16 @@ inspect them.


cronjob

-

Create a cronjob

+

Create a cron job

kubectl create cronjob my-job --image=busybox --schedule="*/1 * * * *"
 
-

Create a cronjob with command

+

Create a cron job with a command

kubectl create cronjob my-job --image=busybox --schedule="*/1 * * * *" -- date
 
-

Create a cronjob with the specified name.

+

Create a cron job with the specified name.

Usage

$ kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]

Flags

@@ -585,22 +585,22 @@ inspect them.


deployment

-

Create a deployment named my-dep that runs the busybox image.

+

Create a deployment named my-dep that runs the busybox image

kubectl create deployment my-dep --image=busybox
 
-

Create a deployment with command

+

Create a deployment with a command

kubectl create deployment my-dep --image=busybox -- date
 
-

Create a deployment named my-dep that runs the nginx image with 3 replicas.

+

Create a deployment named my-dep that runs the nginx image with 3 replicas

kubectl create deployment my-dep --image=nginx --replicas=3
 
-

Create a deployment named my-dep that runs the busybox image and expose port 5701.

+

Create a deployment named my-dep that runs the busybox image and expose port 5701

kubectl create deployment my-dep --image=busybox --port=5701
 
@@ -637,12 +637,6 @@ inspect them.

Name of the manager used to track field ownership. -generator - - -The name of the API generator to use. - - image [] @@ -841,12 +835,12 @@ inspect them.

kubectl create job my-job --image=busybox
 
-

Create a job with command

+

Create a job with a command

kubectl create job my-job --image=busybox -- date
 
-

Create a job from a CronJob named "a-cronjob"

+

Create a job from a cron job named "a-cronjob"

kubectl create job test-job --from=cronjob/a-cronjob
 
@@ -1000,16 +994,16 @@ inspect them.


poddisruptionbudget

-

Create a pod disruption budget named my-pdb that will select all pods with the app=rails label # and require at least one of them being available at any point in time.

+

Create a pod disruption budget named my-pdb that will select all pods with the app=rails label # and require at least one of them being available at any point in time

kubectl create poddisruptionbudget my-pdb --selector=app=rails --min-available=1
 
-

Create a pod disruption budget named my-pdb that will select all pods with the app=nginx label # and require at least half of the pods selected to be available at any point in time.

+

Create a pod disruption budget named my-pdb that will select all pods with the app=nginx label # and require at least half of the pods selected to be available at any point in time

kubectl create pdb my-pdb --selector=app=nginx --min-available=50%
 
-

Create a pod disruption budget with the specified name, selector, and desired minimum available pods

+

Create a pod disruption budget with the specified name, selector, and desired minimum available pods.

Usage

$ kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run=server|client|none]

Flags

@@ -1094,21 +1088,21 @@ inspect them.


priorityclass

-

Create a priorityclass named high-priority

+

Create a priority class named high-priority

kubectl create priorityclass high-priority --value=1000 --description="high priority"
 
-

Create a priorityclass named default-priority that considered as the global default priority

+

Create a priority class named default-priority that is considered as the global default priority

kubectl create priorityclass default-priority --value=1000 --global-default=true --description="default priority"
 
-

Create a priorityclass named high-priority that can not preempt pods with lower priority

+

Create a priority class named high-priority that cannot preempt pods with lower priority

kubectl create priorityclass high-priority --value=1000 --description="high priority" --preemption-policy="Never"
 
-

Create a priorityclass with the specified name, value, globalDefault and description

+

Create a priority class with the specified name, value, globalDefault and description.

Usage

$ kubectl create priorityclass NAME --value=VALUE --global-default=BOOL [--dry-run=server|client|none]

Flags

@@ -1199,16 +1193,16 @@ inspect them.


quota

-

Create a new resourcequota named my-quota

+

Create a new resource quota named my-quota

kubectl create quota my-quota --hard=cpu=1,memory=1G,pods=2,services=3,replicationcontrollers=2,resourcequotas=1,secrets=5,persistentvolumeclaims=10
 
-

Create a new resourcequota named best-effort

+

Create a new resource quota named best-effort

kubectl create quota best-effort --hard=pods=100 --scopes=BestEffort
 
-

Create a resourcequota with the specified name, hard limits and optional scopes

+

Create a resource quota with the specified name, hard limits, and optional scopes.

Usage

$ kubectl create quota NAME [--hard=key1=value1,key2=value2] [--scopes=Scope1,Scope2] [--dry-run=server|client|none]

Flags

@@ -1287,22 +1281,22 @@ inspect them.


role

-

Create a Role named "pod-reader" that allows user to perform "get", "watch" and "list" on pods

+

Create a role named "pod-reader" that allows user to perform "get", "watch" and "list" on pods

kubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods
 
-

Create a Role named "pod-reader" with ResourceName specified

+

Create a role named "pod-reader" with ResourceName specified

kubectl create role pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod
 
-

Create a Role named "foo" with API Group specified

+

Create a role named "foo" with API Group specified

kubectl create role foo --verb=get,list,watch --resource=rs.extensions
 
-

Create a Role named "foo" with SubResource specified

+

Create a role named "foo" with SubResource specified

kubectl create role foo --verb=get,list,watch --resource=pods,pods/status
 
@@ -1391,11 +1385,11 @@ inspect them.


rolebinding

-

Create a RoleBinding for user1, user2, and group1 using the admin ClusterRole

+

Create a role binding for user1, user2, and group1 using the admin cluster role

kubectl create rolebinding admin --clusterrole=admin --user=user1 --user=user2 --group=group1
 
-

Create a RoleBinding for a particular Role or ClusterRole.

+

Create a role binding for a particular role or cluster role.

Usage

$ kubectl create rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]

Flags

@@ -1506,7 +1500,7 @@ inspect them.

'$ 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 + nodes to pull images on your behalf, they must have the credentials. You can provide this information by creating a dockercfg secret and attaching it to your service account.

Usage

$ kubectl create docker-registry NAME --docker-username=user --docker-password=password --docker-email=email [--docker-server=string] [--from-file=[key=]source] [--dry-run=server|client|none]

@@ -1734,12 +1728,12 @@ inspect them.


secret tls

-

Create a new TLS secret named tls-secret with the given key pair:

+

Create a new TLS secret named tls-secret with the given key pair

kubectl create secret tls tls-secret --cert=path/to/tls.cert --key=path/to/tls.key
 

Create a TLS secret from the given public/private key pair.

-

The public/private key pair must exist before hand. The public key certificate must be .PEM encoded and match the given private key.

+

The public/private key pair must exist beforehand. The public key certificate must be .PEM encoded and match the given private key.

Usage

$ kubectl create tls NAME --cert=path/to/cert/file --key=path/to/key/file [--dry-run=server|client|none]

Flags

@@ -1823,7 +1817,7 @@ inspect them.


service

-

Create a service using specified subcommand.

+

Create a service using a specified subcommand.

Usage

$ kubectl create service


@@ -2232,67 +2226,67 @@ inspect them.


get

-

List all pods in ps output format.

+

List all pods in ps output format

kubectl get pods
 
-

List all pods in ps output format with more information (such as node name).

+

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.

+

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:

+

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.

+

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.

+

List a pod identified by type and name specified in "pod.yaml" in JSON output format

kubectl get -f pod.yaml -o json
 
-

List resources from a directory with kustomization.yaml - e.g. dir/kustomization.yaml.

+

List resources from a directory with kustomization.yaml - e.g. dir/kustomization.yaml

kubectl get -k dir/
 
-

Return only the phase value of the specified pod.

+

Return only the phase value of the specified pod

kubectl get -o template pod/web-pod-13je7 --template={{.status.phase}}
 
-

List resource information in custom columns.

+

List resource information in custom columns

kubectl get pod test-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image
 
-

List all replication controllers and services together in ps output format.

+

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.

+

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

+

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

-

$ kubectl 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]

+

$ kubectl get [(-o|--output=)json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file|custom-columns-file|custom-columns|wide] (TYPE[.VERSION][.GROUP] [NAME | -l label] | TYPE[.VERSION][.GROUP]/NAME ...) [flags]

Flags

@@ -2362,7 +2356,7 @@ inspect them.

- + @@ -2447,47 +2441,47 @@ inspect them.


run

-

Start a nginx pod.

+

Start a nginx pod

kubectl run nginx --image=nginx
 
-

Start a hazelcast pod and let the container expose port 5701.

+

Start a hazelcast pod and let the container expose port 5701

kubectl run hazelcast --image=hazelcast/hazelcast --port=5701
 
-

Start a hazelcast pod and set environment variables "DNS_DOMAIN=cluster" and "POD_NAMESPACE=default" in the container.

+

Start a hazelcast pod and set environment variables "DNS_DOMAIN=cluster" and "POD_NAMESPACE=default" in the container

kubectl run hazelcast --image=hazelcast/hazelcast --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default"
 
-

Start a hazelcast pod and set labels "app=hazelcast" and "env=prod" in the container.

+

Start a hazelcast pod and set labels "app=hazelcast" and "env=prod" in the container

kubectl run hazelcast --image=hazelcast/hazelcast --labels="app=hazelcast,env=prod"
 
-

Dry run. Print the corresponding API objects without creating them.

+

Dry run; print the corresponding API objects without creating them

kubectl run nginx --image=nginx --dry-run=client
 
-

Start a nginx pod, but overload the spec with a partial set of values parsed from JSON.

+

Start a nginx pod, but overload the spec with a partial set of values parsed from JSON

kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
 
-

Start a busybox pod and keep it in the foreground, don't restart it if it exits.

+

Start a busybox pod 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 pod using the default command, but use custom arguments (arg1 .. argN) for that command.

+

Start the nginx pod using the default command, but use custom arguments (arg1 .. argN) for that command

kubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN>
 
-

Start the nginx pod using a different command and custom arguments.

+

Start the nginx pod using a different command and custom arguments

kubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>
 
@@ -2738,12 +2732,12 @@ inspect them.


expose

-

Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000.

+

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.

+

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
 
@@ -2763,12 +2757,12 @@ inspect them.

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.

+

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.

+

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
 
@@ -2944,17 +2938,17 @@ inspect them.


delete

-

Delete a pod using the type and name specified in pod.json.

+

Delete a pod using the type and name specified in pod.json

kubectl delete -f ./pod.json
 
-

Delete resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml.

+

Delete resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml

kubectl delete -k dir
 
-

Delete a pod based on the type and name in the JSON passed into stdin.

+

Delete a pod based on the type and name in the JSON passed into stdin

cat pod.json | kubectl delete -f -
 
@@ -2964,7 +2958,7 @@ inspect them.

kubectl delete pod,service baz foo
 
-

Delete pods and services with label name=myLabel.

+

Delete pods and services with label name=myLabel

kubectl delete pods,services -l name=myLabel
 
@@ -2983,10 +2977,10 @@ inspect them.

kubectl delete pods --all
 
-

Delete resources by filenames, stdin, resources and names, or by resources and label selector.

-

JSON and YAML formats are accepted. Only one type of the arguments may be specified: filenames, resources and names, or resources and label selector.

-

Some resources, such as pods, support graceful deletion. These resources define a default period before they are forcibly terminated (the grace period) but you may override that value with the --grace-period flag, or pass --now to set a grace-period of 1. Because these resources often represent entities in the cluster, deletion may not be acknowledged immediately. If the node hosting a pod is down or cannot reach the API server, termination may take significantly longer than the grace period. To force delete a resource, you must specify the --force flag. Note: only a subset of resources support graceful deletion. In absence of the support, --grace-period is ignored.

-

IMPORTANT: Force deleting pods does not wait for confirmation that the pod's processes have been terminated, which can leave those processes running until the node detects the deletion and completes graceful deletion. If your processes use shared storage or talk to a remote API and depend on the name of the pod to identify themselves, force deleting those pods may result in multiple processes running on different machines using the same identification which may lead to data corruption or inconsistency. Only force delete pods when you are sure the pod is terminated, or if your application can tolerate multiple copies of the same pod running at once. Also, if you force delete pods the scheduler may place new pods on those nodes before the node has released those resources and causing those pods to be evicted immediately.

+

Delete resources by file names, stdin, resources and names, or by resources and label selector.

+

JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector.

+

Some resources, such as pods, support graceful deletion. These resources define a default period before they are forcibly terminated (the grace period) but you may override that value with the --grace-period flag, or pass --now to set a grace-period of 1. Because these resources often represent entities in the cluster, deletion may not be acknowledged immediately. If the node hosting a pod is down or cannot reach the API server, termination may take significantly longer than the grace period. To force delete a resource, you must specify the --force flag. Note: only a subset of resources support graceful deletion. In absence of the support, the --grace-period flag is ignored.

+

IMPORTANT: Force deleting pods does not wait for confirmation that the pod's processes have been terminated, which can leave those processes running until the node detects the deletion and completes graceful deletion. If your processes use shared storage or talk to a remote API and depend on the name of the pod to identify themselves, force deleting those pods may result in multiple processes running on different machines using the same identification which may lead to data corruption or inconsistency. Only force delete pods when you are sure the pod is terminated, or if your application can tolerate multiple copies of the same pod running at once. Also, if you force delete pods, the scheduler may place new pods on those nodes before the node has released those resources and causing those pods to be evicted immediately.

Note that the delete command does NOT do resource version checks, so if someone submits an update to a resource right when you submit a delete, their update will be lost along with the rest of the resource.

Usage

$ kubectl delete ([-f FILENAME] | [-k DIRECTORY] | TYPE [(NAME | -l label | --all)])

@@ -3111,31 +3105,31 @@ viewing your workloads in a Kubernetes cluster.


apply

-

Apply the configuration in pod.json to a pod.

+

Apply the configuration in pod.json to a pod

kubectl apply -f ./pod.json
 
-

Apply resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml.

+

Apply resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml

kubectl apply -k dir/
 
-

Apply the JSON passed into stdin to a pod.

+

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.

+

Note: --prune is still in Alpha # Apply the configuration in manifest.yaml that matches label app=nginx and delete all 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.

+

Apply the configuration in manifest.yaml and delete all the other config maps 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'.

+

Apply a configuration to a resource by file name 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

@@ -3300,17 +3294,17 @@ viewing your workloads in a Kubernetes cluster.


edit-last-applied

-

Edit the last-applied-configuration annotations by type/name in YAML.

+

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.

+

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 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 file names 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.

@@ -3392,17 +3386,17 @@ viewing your workloads in a Kubernetes cluster.


set-last-applied

-

Set the last-applied-configuration of a resource to match the contents of a file.

+

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.

+

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.

+

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
 
@@ -3467,7 +3461,7 @@ viewing your workloads in a Kubernetes cluster.


view-last-applied

-

View the last-applied-configuration annotations by type/name in YAML.

+

View the last-applied-configuration annotations by type/name in YAML

kubectl apply view-last-applied deployment/nginx
 
@@ -3477,7 +3471,7 @@ viewing your workloads in a Kubernetes cluster.

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.

+

The default output will be printed to stdout in YAML format. You can use the -o option to change the output format.

Usage

$ kubectl apply view-last-applied (TYPE [NAME | -l label] | TYPE/NAME | -f FILENAME)

Flags

@@ -3532,7 +3526,7 @@ viewing your workloads in a Kubernetes cluster.


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

+

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'
 
@@ -3542,7 +3536,7 @@ viewing your workloads in a Kubernetes cluster.

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.

+

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'
 
@@ -3552,16 +3546,16 @@ viewing your workloads in a Kubernetes cluster.

kubectl annotate pods --all description='my frontend running nginx'
 
-

Update pod 'foo' only if the resource is unchanged from version 1.

+

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.

+

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

+

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.

@@ -3585,6 +3579,12 @@ viewing your workloads in a Kubernetes cluster.

+ + + + + + @@ -3685,17 +3685,17 @@ viewing your workloads in a Kubernetes cluster.


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:

+

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%:

+

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, StatefulSet, 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.

+

Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.

+

Looks up a deployment, replica set, stateful set, or replication controller 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

$ kubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU]

Flags

@@ -3740,12 +3740,6 @@ viewing your workloads in a Kubernetes cluster.

- - - - - - @@ -3960,7 +3954,7 @@ viewing your workloads in a Kubernetes cluster.


diff

-

Diff resources included in pod.json.

+

Diff resources included in pod.json

kubectl diff -f pod.json
 
@@ -3969,10 +3963,10 @@ viewing your workloads in a Kubernetes cluster.

cat service.yaml | kubectl diff -f -
 
-

Diff configurations specified by filename or stdin between the current online configuration, and the configuration as it would be if applied.

-

Output is always YAML.

+

Diff configurations specified by file name or stdin between the current online configuration, and the configuration as it would be if applied.

+

The output is always YAML.

KUBECTL_EXTERNAL_DIFF environment variable can be used to select your own diff command. Users can use external commands with params too, example: KUBECTL_EXTERNAL_DIFF="colordiff -N -u"

-

By default, the "diff" command available in your path will be run with "-u" (unified diff) and "-N" (treat absent files as empty) options.

+

By default, the "diff" command available in your path will be run with the "-u" (unified diff) and "-N" (treat absent files as empty) options.

Exit status: 0 No differences were found. 1 Differences were found. >1 Kubectl or diff failed with an error.

Note: KUBECTL_EXTERNAL_DIFF, if used, is expected to follow that convention.

Usage

@@ -4035,7 +4029,7 @@ viewing your workloads in a Kubernetes cluster.


edit

-

Edit the service named 'docker-registry':

+

Edit the service named 'docker-registry'

kubectl edit svc/docker-registry
 
@@ -4045,17 +4039,17 @@ viewing your workloads in a Kubernetes cluster.

KUBE_EDITOR="nano" kubectl edit svc/docker-registry
 
-

Edit the job 'myjob' in JSON using the v1 API format:

+

Edit the job 'myjob' in JSON using the v1 API format

kubectl edit job.v1.batch/myjob -o json
 
-

Edit the deployment 'mydeployment' in YAML and save the modified config in its annotation:

+

Edit the deployment 'mydeployment' in YAML and save the modified config in its annotation

kubectl edit deployment/mydeployment -o yaml --save-config
 

Edit a resource from the default editor.

-

The edit 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 edit 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 file names as well as command-line arguments, although the files you point to must be previously saved versions of resources.

Editing is done with the API version used to fetch the resource. To edit using a specific API version, fully-qualify the resource, version, and group.

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.

@@ -4185,10 +4179,10 @@ viewing your workloads in a Kubernetes cluster.

- + - + @@ -4197,6 +4191,12 @@ viewing your workloads in a Kubernetes cluster.

+ + + + + + @@ -4209,6 +4209,12 @@ viewing your workloads in a Kubernetes cluster.

+ + + + + + @@ -4249,12 +4255,12 @@ viewing your workloads in a Kubernetes cluster.


label

-

Update pod 'foo' with the label 'unhealthy' and the value 'true'.

+

Update pod 'foo' with the label 'unhealthy' and the value 'true'

kubectl label pods foo unhealthy=true
 
-

Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value.

+

Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value

kubectl label --overwrite pods foo status=unhealthy
 
@@ -4269,19 +4275,19 @@ viewing your workloads in a Kubernetes cluster.

kubectl label -f pod.json status=unhealthy
 
-

Update pod 'foo' only if the resource is unchanged from version 1.

+

Update pod 'foo' only if the resource is unchanged from version 1

kubectl label pods foo status=unhealthy --resource-version=1
 
-

Update pod 'foo' by removing a label named 'bar' if it exists. # Does not require the --overwrite flag.

+

Update pod 'foo' by removing a label named 'bar' if it exists # Does not require the --overwrite flag

kubectl label pods foo bar-
 

Update the labels on a resource.

@@ -4305,6 +4311,12 @@ viewing your workloads in a Kubernetes cluster.

+ + + + + + @@ -4405,31 +4417,31 @@ viewing your workloads in a Kubernetes cluster.


patch

-

Partially update a node using a strategic merge patch. Specify the patch as JSON.

+

Partially update a node using a strategic merge patch, specifying the patch as JSON

kubectl patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}'
 
-

Partially update a node using a strategic merge patch. Specify the patch as YAML.

+

Partially update a node using a strategic merge patch, specifying the patch as YAML

kubectl patch node k8s-node-1 -p $'spec:\n unschedulable: true'
 
-

Partially update a node identified by the type and name specified in "node.json" using strategic merge patch.

+

Partially update a node identified by the type and name specified in "node.json" using strategic merge patch

kubectl patch -f node.json -p '{"spec":{"unschedulable":true}}'
 
-

Update a container's image; spec.containers[*].name is required because it's a merge key.

+

Update a container's image; spec.containers[*].name is required because it's a merge key

kubectl patch pod valid-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}'
 
-

Update a container's image using a json patch with positional arrays.

+

Update a container's image using a JSON patch with positional arrays

kubectl patch pod valid-pod --type='json' -p='[{"op": "replace", "path": "/spec/containers/0/image", "value":"new image"}]'
 
-

Update field(s) of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.

+

Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.

JSON and YAML formats are accepted.

Usage

$ kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]

@@ -4533,12 +4545,12 @@ viewing your workloads in a Kubernetes cluster.


replace

-

Replace a pod using the data in pod.json.

+

Replace a pod using the data in pod.json

kubectl replace -f ./pod.json
 
-

Replace a pod based on the JSON passed into stdin.

+

Replace a pod based on the JSON passed into stdin

cat pod.json | kubectl replace -f -
 
@@ -4552,7 +4564,7 @@ viewing your workloads in a Kubernetes cluster.

kubectl replace --force -f ./pod.json
 
-

Replace a resource by filename or stdin.

+

Replace a resource by file name or stdin.

JSON and YAML formats are accepted. If replacing an existing resource, the complete resource spec must be provided. This can be obtained by

$ kubectl get TYPE NAME -o yaml

Usage

@@ -4772,11 +4784,11 @@ viewing your workloads in a Kubernetes cluster.


pause

-

Mark the nginx deployment as paused. Any current state of # the deployment will continue its function, new updates to the deployment will not # have an effect as long as the deployment is paused.

+

Mark the nginx deployment as paused # Any current state of the deployment will continue its function; new updates # to the deployment will not have an effect as long as the deployment is paused

kubectl rollout pause deployment/nginx
 
-

Mark the provided resource as paused

+

Mark the provided resource as paused.

Paused resources will not be reconciled by a controller. Use "kubectl rollout resume" to resume a paused resource. Currently only deployments support being paused.

Usage

$ kubectl rollout pause RESOURCE

@@ -4849,12 +4861,12 @@ viewing your workloads in a Kubernetes cluster.

kubectl rollout restart deployment/nginx
 
-

Restart a daemonset

+

Restart a daemon set

kubectl rollout restart daemonset/abc
 

Restart a resource.

-

Resource will be rollout restarted.

+

Resource rollout will be restarted.

Usage

$ kubectl rollout restart RESOURCE

Flags

@@ -4925,7 +4937,7 @@ viewing your workloads in a Kubernetes cluster.

kubectl rollout resume deployment/nginx
 
-

Resume a paused resource

+

Resume a paused resource.

Paused resources will not be reconciled by a controller. By resuming a resource, we allow it to be reconciled again. Currently only deployments support being resumed.

Usage

$ kubectl rollout resume RESOURCE

@@ -5053,21 +5065,21 @@ viewing your workloads in a Kubernetes cluster.


undo

-

Rollback to the previous deployment

+

Roll back to the previous deployment

kubectl rollout undo deployment/abc
 
-

Rollback to daemonset revision 3

+

Roll back to daemonset revision 3

kubectl rollout undo daemonset/abc --to-revision=3
 
-

Rollback to the previous deployment with dry-run

+

Roll back to the previous deployment with dry-run

kubectl rollout undo --dry-run=server deployment/abc
 
-

Rollback to a previous rollout.

+

Roll back to a previous rollout.

Usage

$ kubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]

Flags

@@ -5140,31 +5152,31 @@ viewing your workloads in a Kubernetes cluster.


scale

-

Scale a replicaset named 'foo' to 3.

+

Scale a replica set named 'foo' to 3

kubectl scale --replicas=3 rs/foo
 
-

Scale a resource identified by type and name specified in "foo.yaml" to 3.

+

Scale a resource identified by type and name specified in "foo.yaml" to 3

kubectl scale --replicas=3 -f foo.yaml
 
-

If the deployment named mysql's current size is 2, scale mysql to 3.

+

If the deployment named mysql's current size is 2, scale mysql to 3

kubectl scale --current-replicas=2 --replicas=3 deployment/mysql
 
-

Scale multiple replication controllers.

+

Scale multiple replication controllers

kubectl scale --replicas=5 rc/foo rc/bar rc/baz
 
-

Scale statefulset named 'web' to 3.

+

Scale stateful set named 'web' to 3

kubectl scale --replicas=3 statefulset/web
 
-

Set a new size for a Deployment, ReplicaSet, Replication Controller, or StatefulSet.

+

Set a new size for a deployment, replica set, replication controller, or stateful set.

Scale also allows users to specify one or more preconditions for the scale action.

If --current-replicas or --resource-version is specified, it is validated before the scale is attempted, and it is guaranteed that the precondition holds true when the scale is sent to the server.

Usage

@@ -5196,7 +5208,7 @@ viewing your workloads in a Kubernetes cluster.

- + @@ -5274,7 +5286,7 @@ viewing your workloads in a Kubernetes cluster.

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 format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file|custom-columns-file|custom-columns|wide See custom columns [https://kubernetes.io/docs/reference/kubectl/overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [https://kubernetes.io/docs/reference/kubectl/jsonpath/].
output-watch-events Select all resources, including uninitialized ones, in the namespace of the specified resource types.
all-namespacesAfalseIf true, check the specified action in all namespaces.
allow-missing-template-keys true Filename, directory, or URL to files identifying the resource to autoscale.
generatorhorizontalpodautoscaler/v1The name of the API generator to use. Currently there is only 1 generator.
kustomize k
allow-id-changesas-current-user falseenable changes to a resourceId use the uid and gid of the command executor to run the function in the container
enable-alpha-plugins enable kustomize plugins
enable-helmfalseEnable use of the Helm chart inflator generator.
enable-managedby-label false a list of environment variables to be used by functions
helm-commandhelmhelm command (path to executable)
load-restrictor LoadRestrictionsRootOnly Select all resources, including uninitialized ones, in the namespace of the specified resource types
all-namespacesAfalseIf true, check the specified action in all namespaces.
allow-missing-template-keys true current-replicas -1Precondition for current size. Requires that the current size of the resource match this value in order to scale. Precondition for current size. Requires that the current size of the resource match this value in order to scale. -1 (default) for no condition.
dry-run

set

-

Configure application resources

+

Configure application resources.

These commands help you make changes to existing application resources.

Usage

$ kubectl set SUBCOMMAND

@@ -5339,7 +5351,7 @@ viewing your workloads in a Kubernetes cluster.

List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templates (within replication controllers or deployment configurations). View or modify the environment variable definitions on all containers in the specified pods or pod templates, or just those that match a wildcard.

If "--env -" is passed, environment variables can be read from STDIN using the standard env syntax.

Possible resources include (case insensitive):

-

pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs)

+

pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs)

Usage

$ kubectl set env RESOURCE/NAME KEY_1=VAL_1 ... KEY_N=VAL_N

Flags

@@ -5478,7 +5490,7 @@ viewing your workloads in a Kubernetes cluster.


image

-

Set a deployment's nginx container image to 'nginx:1.9.1', and its busybox container image to 'busybox'.

+

Set a deployment's nginx container image to 'nginx:1.9.1', and its busybox container image to 'busybox'

kubectl set image deployment/nginx busybox=busybox nginx=nginx:1.9.1
 
@@ -5499,7 +5511,7 @@ viewing your workloads in a Kubernetes cluster.

Update existing container image(s) of resources.

Possible resources include (case insensitive):

-

pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), replicaset (rs)

+

pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs)

Usage

$ kubectl set image (-f FILENAME | TYPE NAME) CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N

Flags

@@ -5615,8 +5627,8 @@ viewing your workloads in a Kubernetes cluster.

kubectl set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml
 
-

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.

+

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): Use "kubectl api-resources" for a complete list of supported resources..

Usage

$ kubectl set resources (-f FILENAME | TYPE NAME) ([--limits=LIMITS & --requests=REQUESTS]

@@ -5732,7 +5744,7 @@ viewing your workloads in a Kubernetes cluster.


selector

-

set the labels and selector before creating a deployment/service pair.

+

Set the labels and selector before creating a deployment/service pair

kubectl create service clusterip my-svc --clusterip="None" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -
 kubectl create deployment my-dep -o yaml --dry-run=client | kubectl label --local -f - environment=qa -o yaml | kubectl create -f -
@@ -5829,16 +5841,16 @@ kubectl create deployment my-dep -o yaml --dry-run<
 

serviceaccount

-

Set Deployment nginx-deployment's ServiceAccount to serviceaccount1

+

Set deployment nginx-deployment's service account to serviceaccount1

kubectl set serviceaccount deployment nginx-deployment serviceaccount1
 
-

Print the result (in yaml format) of updated nginx deployment with serviceaccount from local file, without hitting apiserver

+

Print the result (in YAML format) of updated nginx deployment with the service account from local file, without hitting the API server

kubectl set sa -f nginx-deployment.yaml serviceaccount1 --local --dry-run=client -o yaml
 
-

Update ServiceAccount of pod template resources.

+

Update the service account of pod template resources.

Possible resources (case insensitive) can be:

replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset

Usage

@@ -5931,21 +5943,21 @@ kubectl create deployment my-dep -o yaml --dry-run<

subject

-

Update a ClusterRoleBinding for serviceaccount1

+

Update a cluster role binding for serviceaccount1

kubectl set subject clusterrolebinding admin --serviceaccount=namespace:serviceaccount1
 
-

Update a RoleBinding for user1, user2, and group1

+

Update a role binding for user1, user2, and group1

kubectl set subject rolebinding admin --user=user1 --user=user2 --group=group1
 
-

Print the result (in yaml format) of updating rolebinding subjects from a local, without hitting the server

+

Print the result (in YAML format) of updating rolebinding subjects from a local, without hitting the server

kubectl create rolebinding admin --role=admin --user=admin -o yaml --dry-run=client | kubectl set subject --local -f - --user=foo -o yaml
 
-

Update User, Group or ServiceAccount in a RoleBinding/ClusterRoleBinding.

+

Update the user, group, or service account in a role binding or cluster role binding.

Usage

$ kubectl set subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]

Flags

@@ -6048,17 +6060,17 @@ kubectl create deployment my-dep -o yaml --dry-run<

wait

-

Wait for the pod "busybox1" to contain the status condition of type "Ready".

+

Wait for the pod "busybox1" to contain the status condition of type "Ready"

kubectl wait --for=condition=Ready pod/busybox1
 
-

The default value of status condition is true, you can set false.

+

The default value of status condition is true; you can set it to false

kubectl wait --for=condition=Ready=false pod/busybox1
 
-

Wait for the pod "busybox1" to be deleted, with a timeout of 60s, after having issued the "delete" command.

+

Wait for the pod "busybox1" to be deleted, with a timeout of 60s, after having issued the "delete" command

kubectl delete pod/busybox1
 kubectl wait --for=delete pod/busybox1 --timeout=60s
@@ -6066,7 +6078,7 @@ kubectl wait --for=delete pod/busybox1 Experimental: Wait for a specific condition on one or many resources.

The command takes multiple resources and waits until the specified condition is seen in the Status field of every given resource.

Alternatively, the command can wait for the given set of resources to be deleted by providing the "delete" keyword as the value to the --for flag.

-

A successful message will be printed to stdout indicating when the specified condition has been met. One can use -o option to change to output destination.

+

A successful message will be printed to stdout indicating when the specified condition has been met. You can use -o option to change to output destination.

Usage

$ kubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=delete|--for condition=available]

Flags

@@ -6171,7 +6183,7 @@ applications.


attach

-

Get output from running pod mypod, use the kubectl.kubernetes.io/default-container annotation # for selecting the container to be attached or the first container in the pod will be chosen

+

Get output from running pod mypod; use the 'kubectl.kubernetes.io/default-container' annotation # for selecting the container to be attached or the first container in the pod will be chosen

kubectl attach mypod
 
@@ -6181,12 +6193,12 @@ applications.

kubectl attach mypod -c ruby-container
 
-

Switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod mypod # and sends stdout/stderr from 'bash' back to the client

+

Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod # and sends stdout/stderr from 'bash' back to the client

kubectl attach mypod -c ruby-container -i -t
 
-

Get output from the first pod of a ReplicaSet named nginx

+

Get output from the first pod of a replica set named nginx

kubectl attach rs/nginx
 
@@ -6279,7 +6291,7 @@ applications.

kubectl auth can-i --list --namespace=foo
 

Check whether an action is allowed.

-

VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial URL starts with "/". NAME is the name of a particular Kubernetes resource.

+

VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial URL that starts with "/". NAME is the name of a particular Kubernetes resource.

Usage

$ kubectl auth can-i VERB [TYPE | TYPE/NAME | NONRESOURCEURL]

Flags

@@ -6328,11 +6340,11 @@ applications.


reconcile

-

Reconcile rbac resources from a file

+

Reconcile RBAC resources from a file

kubectl auth reconcile -f my-rbac-rules.yaml
 
-

Reconciles rules for RBAC Role, RoleBinding, ClusterRole, and ClusterRoleBinding objects.

+

Reconciles rules for RBAC role, role binding, cluster role, and cluster role binding objects.

Missing objects are created, and the containing namespace is created for namespaced objects, if required.

Existing roles are updated to include the permissions in the input objects, and remove extra permissions if --remove-extra-permissions is specified.

Existing bindings are updated to include the subjects in the input objects, and remove extra subjects if --remove-extra-subjects is specified.

@@ -6415,7 +6427,7 @@ applications.


cp

-

!!!Important Note!!! # Requires that the 'tar' binary is present in your container # image. If 'tar' is not present, 'kubectl cp' will fail. # # For advanced use cases, such as symlinks, wildcard expansion or # file mode preservation consider using 'kubectl exec'. # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace

+

!!!Important Note!!! # Requires that the 'tar' binary is present in your container # image. If 'tar' is not present, 'kubectl cp' will fail. # # For advanced use cases, such as symlinks, wildcard expansion or # file mode preservation, consider using 'kubectl exec'. # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace

tar cf - /tmp/foo | kubectl exec -i -n <some-namespace> <some-pod> -- tar xf - -C /tmp/bar
 
@@ -6500,11 +6512,11 @@ applications.

kubectl describe po -l name=myLabel
 
-

Describe all pods managed by the 'frontend' replication controller (rc-created pods # get the name of the rc as a prefix in the pod the name).

+

Describe all pods managed by the 'frontend' replication controller (rc-created pods # get the name of the rc as a prefix in the pod the name)

kubectl describe pods frontend
 
-

Show details of a specific resource or group of resources

+

Show details of a specific resource or group of resources.

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.

@@ -6529,6 +6541,12 @@ applications.

If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace. +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. + + filename f [] @@ -6563,22 +6581,22 @@ applications.


exec

-

Get output from running 'date' command from pod mypod, using the first container by default

+

Get output from running the 'date' command from pod mypod, using the first container by default

kubectl exec mypod -- date
 
-

Get output from running 'date' command in ruby-container from pod mypod

+

Get output from running the 'date' command in ruby-container from pod mypod

kubectl exec mypod -c ruby-container -- date
 
-

Switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod mypod # and sends stdout/stderr from 'bash' back to the client

+

Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod # and sends stdout/stderr from 'bash' back to the client

kubectl exec mypod -c ruby-container -i -t -- bash -il
 
-

List contents of /usr from the first container of pod mypod and sort by modification time. # If the command you want to execute in the pod has any flags in common (e.g. -i), # you must use two dashes (--) to separate your command's flags/arguments. # Also note, do not surround your command and its flags/arguments with quotes # unless that is how you would execute it normally (i.e., do ls -t /usr, not "ls -t /usr").

+

List contents of /usr from the first container of pod mypod and sort by modification time # If the command you want to execute in the pod has any flags in common (e.g. -i), # you must use two dashes (--) to separate your command's flags/arguments # Also note, do not surround your command and its flags/arguments with quotes # unless that is how you would execute it normally (i.e., do ls -t /usr, not "ls -t /usr")

kubectl exec mypod -i -t -- ls -t /usr
 
@@ -6659,7 +6677,7 @@ applications.

Return snapshot logs from all containers in pods defined by label app=nginx

-
kubectl logs -lapp=nginx --all-containers=true
+
kubectl logs -l app=nginx --all-containers=true
 

Return snapshot of previous terminated ruby container logs from pod web-1

@@ -6674,7 +6692,7 @@ applications.

Begin streaming the logs from all containers in pods defined by label app=nginx

-
kubectl logs -f -lapp=nginx --all-containers=true
+
kubectl logs -f -l app=nginx --all-containers=true
 

Display only the most recent 20 lines of output in pod nginx

@@ -6844,9 +6862,9 @@ applications.

kubectl port-forward pod/mypod :5000
 
-

Forward one or more local ports to a pod. This command requires the node to have 'socat' installed.

+

Forward one or more local ports to a pod.

Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.

-

If there are multiple pods matching the criteria, a pod will be selected automatically. The forwarding session ends when the selected pod terminates, and rerun of the command is needed to resume forwarding.

+

If there are multiple pods matching the criteria, a pod will be selected automatically. The forwarding session ends when the selected pod terminates, and a rerun of the command is needed to resume forwarding.

Usage

$ kubectl port-forward TYPE/NAME [options] [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N]

Flags

@@ -6877,36 +6895,36 @@ applications.


proxy

-

To proxy all of the kubernetes api and nothing else.

+

To proxy all of the Kubernetes API and nothing else

kubectl proxy --api-prefix=/
 
-

To proxy only part of the kubernetes api and also some static files. # You can get pods info with 'curl localhost:8001/api/v1/pods'

+

To proxy only part of the Kubernetes API and also some static files # You can get pods info with 'curl localhost:8001/api/v1/pods'

kubectl proxy --www=/my/files --www-prefix=/static/ --api-prefix=/api/
 
-

To proxy the entire kubernetes api at a different root. # You can get pods info with 'curl localhost:8001/custom/api/v1/pods'

+

To proxy the entire Kubernetes API at a different root # You can get pods info with 'curl localhost:8001/custom/api/v1/pods'

kubectl proxy --api-prefix=/custom/
 
-

Run a proxy to kubernetes apiserver on port 8011, serving static content from ./local/www/

+

Run a proxy to the Kubernetes API server on port 8011, serving static content from ./local/www/

kubectl proxy --port=8011 --www=./local/www/
 
-

Run a proxy to kubernetes apiserver on an arbitrary local port. # The chosen port for the server will be output to stdout.

+

Run a proxy to the Kubernetes API server on an arbitrary local port # The chosen port for the server will be output to stdout

kubectl proxy --port=0
 
-

Run a proxy to kubernetes apiserver, changing the api prefix to k8s-api # This makes e.g. the pods api available at localhost:8001/k8s-api/v1/pods/

+

Run a proxy to the Kubernetes API server, changing the API prefix to k8s-api # This makes e.g. the pods API available at localhost:8001/k8s-api/v1/pods/

kubectl proxy --api-prefix=/k8s-api
 
-

Creates a proxy server or application-level gateway between localhost and the Kubernetes API Server. It also allows serving static content over specified HTTP path. All incoming data enters through one port and gets forwarded to the remote kubernetes API Server port, except for the path matching the static content path.

+

Creates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through one port and gets forwarded to the remote Kubernetes API server port, except for the path matching the static content path.

Usage

$ kubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix]

Flags

@@ -7013,7 +7031,7 @@ applications.

kubectl top node NODE_NAME
 
-

Display Resource (CPU/Memory) usage of nodes.

+

Display resource (CPU/memory) usage of nodes.

The top-node command allows you to see the resource consumption of nodes.

Usage

$ kubectl top node [NAME | -l label]

@@ -7049,8 +7067,8 @@ applications.

use-protocol-buffers -false -If present, protocol-buffers will be used to request metrics. +true +Enables using protocol-buffers to access Metrics API. @@ -7076,7 +7094,7 @@ applications.

kubectl top pod -l name=myLabel
 
-

Display Resource (CPU/Memory) usage of pods.

+

Display resource (CPU/memory) usage of pods.

The 'top pod' command allows you to see the resource consumption of pods.

Due to the metrics pipeline delay, they may be unavailable for a few minutes since pod creation.

Usage

@@ -7105,6 +7123,12 @@ applications.

If present, print usage of containers within a pod. +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. + + no-headers false @@ -7125,8 +7149,8 @@ applications.

use-protocol-buffers -false -If present, protocol-buffers will be used to request metrics. +true +Enables using protocol-buffers to access Metrics API. @@ -7138,7 +7162,7 @@ applications.

kubectl api-versions
 
-

Print the supported API versions on the server, in the form of "group/version"

+

Print the supported API versions on the server, in the form of "group/version".

Usage

$ kubectl api-versions


@@ -7148,6 +7172,11 @@ applications.

$ kubectl certificate SUBCOMMAND


approve

+
+

Approve CSR 'csr-sqgzp'

+
+
kubectl certificate approve csr-sqgzp
+

Approve a certificate signing request.

kubectl certificate approve allows a cluster admin to approve a certificate signing request (CSR). This action tells a certificate signing controller to issue a certificate to the requestor with the attributes requested in the CSR.

SECURITY NOTICE: Depending on the requested attributes, the issued certificate can potentially grant a requester access to cluster resources or to authenticate as a requested identity. Before approving a CSR, ensure you understand what the signed certificate can do.

@@ -7216,6 +7245,11 @@ applications.


deny

+
+

Deny CSR 'csr-sqgzp'

+
+
kubectl certificate deny csr-sqgzp
+

Deny a certificate signing request.

kubectl certificate deny allows a cluster admin to deny a certificate signing request (CSR). This action tells a certificate signing controller to not to issue a certificate to the requestor.

Usage

@@ -7288,7 +7322,7 @@ applications.

kubectl cluster-info
 
-

Display addresses of the control plane and services with label kubernetes.io/cluster-service=true To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

+

Display addresses of the control plane and services with label kubernetes.io/cluster-service=true. To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

Usage

$ kubectl cluster-info


@@ -7313,8 +7347,8 @@ applications.

kubectl cluster-info dump --namespaces default,kube-system --output-directory=/path/to/cluster-state
 
-

Dumps cluster info out suitable for debugging and diagnosing cluster problems. By default, dumps everything to stdout. You can optionally specify a directory with --output-directory. If you specify a directory, kubernetes will build a set of files in that directory. By default only dumps things in the 'kube-system' namespace, but you can switch to a different namespace with the --namespaces flag, or specify --all-namespaces to dump all namespaces.

-

The command also dumps the logs of all of the pods in the cluster, these logs are dumped into different directories based on namespace and pod name.

+

Dump cluster information out suitable for debugging and diagnosing cluster problems. By default, dumps everything to stdout. You can optionally specify a directory with --output-directory. If you specify a directory, Kubernetes will build a set of files in that directory. By default, only dumps things in the current namespace and 'kube-system' namespace, but you can switch to a different namespace with the --namespaces flag, or specify --all-namespaces to dump all namespaces.

+

The command also dumps the logs of all of the pods in the cluster; these logs are dumped into different directories based on namespace and pod name.

Usage

$ kubectl cluster-info dump

Flags

@@ -7381,7 +7415,7 @@ applications.


cordon

-

Mark node "foo" as unschedulable.

+

Mark node "foo" as unschedulable

kubectl cordon foo
 
@@ -7416,20 +7450,20 @@ applications.


drain

-

Drain node "foo", even if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet on it.

+

Drain node "foo", even if there are pods not managed by a replication controller, replica set, job, daemon set or stateful set on it

-
$ kubectl drain foo --force
+
kubectl drain foo --force
 
-

As above, but abort if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet, and use a grace period of 15 minutes.

+

As above, but abort if there are pods not managed by a replication controller, replica set, job, daemon set or stateful set, and use a grace period of 15 minutes

-
$ kubectl drain foo --grace-period=900
+
kubectl drain foo --grace-period=900
 

Drain node in preparation for maintenance.

-

The given node will be marked unschedulable to prevent new pods from arriving. 'drain' evicts the pods if the APIServer supports http://kubernetes.io/docs/admin/disruptions/ . Otherwise, it will use normal DELETE to delete the pods. The 'drain' evicts or deletes all pods except mirror pods (which cannot be deleted through the API server). If there are DaemonSet-managed pods, drain will not proceed without --ignore-daemonsets, and regardless it will not delete any DaemonSet-managed pods, because those pods would be immediately replaced by the DaemonSet controller, which ignores unschedulable markings. If there are any pods that are neither mirror pods nor managed by ReplicationController, ReplicaSet, DaemonSet, StatefulSet or Job, then drain will not delete any pods unless you use --force. --force will also allow deletion to proceed if the managing resource of one or more pods is missing.

+

The given node will be marked unschedulable to prevent new pods from arriving. 'drain' evicts the pods if the API server supports https://kubernetes.io/docs/concepts/workloads/pods/disruptions/ . Otherwise, it will use normal DELETE to delete the pods. The 'drain' evicts or deletes all pods except mirror pods (which cannot be deleted through the API server). If there are daemon set-managed pods, drain will not proceed without --ignore-daemonsets, and regardless it will not delete any daemon set-managed pods, because those pods would be immediately replaced by the daemon set controller, which ignores unschedulable markings. If there are any pods that are neither mirror pods nor managed by a replication controller, replica set, daemon set, stateful set, or job, then drain will not delete any pods unless you use --force. --force will also allow deletion to proceed if the managing resource of one or more pods is missing.

'drain' waits for graceful termination. You should not operate on the machine until the command completes.

When you are ready to put the node back into service, use kubectl uncordon, which will make the node schedulable again.

-

http://kubernetes.io/images/docs/kubectl_drain.svg

+

https://kubernetes.io/images/docs/kubectl_drain.svg

Usage

$ kubectl drain NODE

Flags

@@ -7444,6 +7478,12 @@ applications.

+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. + + delete-emptydir-data false @@ -7520,12 +7560,12 @@ applications.


taint

-

Update node 'foo' with a taint with key 'dedicated' and value 'special-user' and effect 'NoSchedule'. # If a taint with that key and effect already exists, its value is replaced as specified.

+

Update node 'foo' with a taint with key 'dedicated' and value 'special-user' and effect 'NoSchedule' # If a taint with that key and effect already exists, its value is replaced as specified

kubectl taint nodes foo dedicated=special-user:NoSchedule
 
-

Remove from node 'foo' the taint with key 'dedicated' and effect 'NoSchedule' if one exists.

+

Remove from node 'foo' the taint with key 'dedicated' and effect 'NoSchedule' if one exists

kubectl taint nodes foo dedicated:NoSchedule-
 
@@ -7548,7 +7588,7 @@ applications.

  • A taint consists of a key, value, and effect. As an argument here, it is expressed as key=value:effect.
  • The key must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to 253 characters.
  • -
  • Optionally, the key can begin with a DNS subdomain prefix and a single '/', like example.com/my-app
  • +
  • Optionally, the key can begin with a DNS subdomain prefix and a single '/', like example.com/my-app.
  • The value is optional. If given, it must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to 63 characters.
  • The effect must be NoSchedule, PreferNoSchedule or NoExecute.
  • Currently taint can only apply to node.
  • @@ -7631,9 +7671,9 @@ applications.


    uncordon

    -

    Mark node "foo" as schedulable.

    +

    Mark node "foo" as schedulable

    -
    $ kubectl uncordon foo
    +
    kubectl uncordon foo
     

    Mark node as schedulable.

    Usage

    @@ -7672,17 +7712,17 @@ applications.


    api-resources

    -

    Print the supported API Resources

    +

    Print the supported API resources

    kubectl api-resources
     
    -

    Print the supported API Resources with more information

    +

    Print the supported API resources with more information

    kubectl api-resources -o wide
     
    -

    Print the supported API Resources sorted by a column

    +

    Print the supported API resources sorted by a column

    kubectl api-resources --sort-by=name
     
    @@ -7697,11 +7737,11 @@ applications.

    kubectl api-resources --namespaced=false
     
    -

    Print the supported API Resources with specific APIGroup

    +

    Print the supported API resources with a specific APIGroup

    kubectl api-resources --api-group=extensions
     
    -

    Print the supported API resources on the server

    +

    Print the supported API resources on the server.

    Usage

    $ kubectl api-resources

    Flags

    @@ -7772,12 +7812,12 @@ applications.

    brew install bash-completion@2
     
    -

    If kubectl is installed via homebrew, this should start working immediately. ## If you've installed via other means, you may need add the completion to your completion directory

    +

    If kubectl is installed via homebrew, this should start working immediately ## If you've installed via other means, you may need add the completion to your completion directory

    kubectl completion bash > $(brew --prefix)/etc/bash_completion.d/kubectl
     
    -

    Installing bash completion on Linux ## If bash-completion is not installed on Linux, please install the 'bash-completion' package ## via your distribution's package manager. ## Load the kubectl completion code for bash into the current shell

    +

    Installing bash completion on Linux ## If bash-completion is not installed on Linux, install the 'bash-completion' package ## via your distribution's package manager. ## Load the kubectl completion code for bash into the current shell

    source <(kubectl completion bash)
     
    @@ -7805,8 +7845,14 @@ source $HOME/.bash_profile
    kubectl completion zsh > "${fpath[1]}/_kubectl"
     

    Output shell completion code for the specified shell (bash or zsh). The shell code must be evaluated to provide interactive completion of kubectl commands. This can be done by sourcing it from the .bash_profile.

    -

    Detailed instructions on how to do this are available here: https://kubernetes.io/docs/tasks/tools/install-kubectl/#enabling-shell-autocompletion

    -

    Note for zsh users: [1] zsh completions are only supported in versions of zsh >= 5.2

    +

    Detailed instructions on how to do this are available here:

    +

    for macOS: + https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/#enable-shell-autocompletion

    +

    for linux: + https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/#enable-shell-autocompletion

    +

    for windows: + https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/#enable-shell-autocompletion

    +

    Note for zsh users: [1] zsh completions are only supported in versions of zsh >= 5.2.

    Usage

    $ kubectl completion SHELL


    @@ -7827,7 +7873,7 @@ source $HOME/.bash_profile
    kubectl config current-context
     
    -

    Displays the current-context

    +

    Display the current-context.

    Usage

    $ kubectl config current-context


    @@ -7837,7 +7883,7 @@ source $HOME/.bash_profile
    kubectl config delete-cluster minikube
     
    -

    Delete the specified cluster from the kubeconfig

    +

    Delete the specified cluster from the kubeconfig.

    Usage

    $ kubectl config delete-cluster NAME


    @@ -7847,7 +7893,7 @@ source $HOME/.bash_profile
    kubectl config delete-context minikube
     
    -

    Delete the specified context from the kubeconfig

    +

    Delete the specified context from the kubeconfig.

    Usage

    $ kubectl config delete-context NAME


    @@ -7857,13 +7903,13 @@ source $HOME/.bash_profile
    kubectl config delete-user minikube
     
    -

    Delete the specified user from the kubeconfig

    +

    Delete the specified user from the kubeconfig.

    Usage

    $ kubectl config delete-user NAME


    get-clusters

    -

    List the clusters kubectl knows about

    +

    List the clusters that kubectl knows about

    kubectl config get-clusters
     
    @@ -7878,11 +7924,11 @@ source $HOME/.bash_profile
    kubectl config get-contexts
     
    -

    Describe one context in your kubeconfig file.

    +

    Describe one context in your kubeconfig file

    kubectl config get-contexts my-context
     
    -

    Displays one or many contexts from the kubeconfig file.

    +

    Display one or many contexts from the kubeconfig file.

    Usage

    $ kubectl config get-contexts [(-o|--output=)name)]

    Flags

    @@ -7913,7 +7959,7 @@ source $HOME/.bash_profile

    get-users

    -

    List the users kubectl knows about

    +

    List the users that kubectl knows about

    kubectl config get-users
     
    @@ -7928,37 +7974,37 @@ source $HOME/.bash_profile
    kubectl config rename-context old-name new-name
     

    Renames a context from the kubeconfig file.

    -

    CONTEXT_NAME is the context name that you wish to change.

    -

    NEW_NAME is the new name you wish to set.

    -

    Note: In case the context being renamed is the 'current-context', this field will also be updated.

    +

    CONTEXT_NAME is the context name that you want to change.

    +

    NEW_NAME is the new name you want to set.

    +

    Note: If the context being renamed is the 'current-context', this field will also be updated.

    Usage

    $ kubectl config rename-context CONTEXT_NAME NEW_NAME


    set

    -

    Set server field on the my-cluster cluster to https://1.2.3.4

    +

    Set the server field on the my-cluster cluster to https://1.2.3.4

    kubectl config set clusters.my-cluster.server https://1.2.3.4
     
    -

    Set certificate-authority-data field on the my-cluster cluster.

    +

    Set the certificate-authority-data field on the my-cluster cluster

    kubectl config set clusters.my-cluster.certificate-authority-data $(echo "cert_data_here" | base64 -i -)
     
    -

    Set cluster field in the my-context context to my-cluster.

    +

    Set the cluster field in the my-context context to my-cluster

    kubectl config set contexts.my-context.cluster my-cluster
     
    -

    Set client-key-data field in the cluster-admin user using --set-raw-bytes option.

    +

    Set the client-key-data field in the cluster-admin user using --set-raw-bytes option

    kubectl config set users.cluster-admin.client-key-data cert_data_here --set-raw-bytes=true
     
    -

    Sets an individual value in a kubeconfig file

    +

    Set an individual value in a kubeconfig file.

    PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.

    -

    PROPERTY_VALUE is the new value you wish to set. Binary fields such as 'certificate-authority-data' expect a base64 encoded string unless the --set-raw-bytes flag is used.

    -

    Specifying a attribute name that already exists will merge new fields on top of existing values.

    +

    PROPERTY_VALUE is the new value you want to set. Binary fields such as 'certificate-authority-data' expect a base64 encoded string unless the --set-raw-bytes flag is used.

    +

    Specifying an attribute name that already exists will merge new fields on top of existing values.

    Usage

    $ kubectl config set PROPERTY_NAME PROPERTY_VALUE

    Flags

    @@ -7983,7 +8029,7 @@ source $HOME/.bash_profile

    set-cluster

    -

    Set only the server field on the e2e cluster entry without touching other values.

    +

    Set only the server field on the e2e cluster entry without touching other values

    kubectl config set-cluster e2e --server=https://1.2.3.4
     
    @@ -8002,7 +8048,7 @@ source $HOME/.bash_profile
    kubectl config set-cluster e2e --tls-server-name=my-cluster-name
     
    -

    Sets a cluster entry in kubeconfig.

    +

    Set a cluster entry in kubeconfig.

    Specifying a name that already exists will merge new fields on top of existing values for those fields.

    Usage

    $ kubectl config set-cluster NAME [--server=server] [--certificate-authority=path/to/certificate/authority] [--insecure-skip-tls-verify=true] [--tls-server-name=example.com]

    @@ -8032,7 +8078,7 @@ source $HOME/.bash_profile
    kubectl config set-context gce --user=cluster-admin
     
    -

    Sets a context entry in kubeconfig

    +

    Set a context entry in kubeconfig.

    Specifying a name that already exists will merge new fields on top of existing values for those fields.

    Usage

    $ kubectl config set-context [NAME | --current] [--cluster=cluster_nickname] [--user=user_nickname] [--namespace=namespace]

    @@ -8058,7 +8104,7 @@ source $HOME/.bash_profile

    set-credentials

    -

    Set only the "client-key" field on the "cluster-admin" # entry, without touching other values:

    +

    Set only the "client-key" field on the "cluster-admin" # entry, without touching other values

    kubectl config set-credentials cluster-admin --client-key=~/.kube/admin.key
     
    @@ -8107,7 +8153,7 @@ source $HOME/.bash_profile
    kubectl config set-credentials cluster-admin --exec-env=var-to-remove-
     
    -

    Sets a user entry in kubeconfig

    +

    Set a user entry in kubeconfig.

    Specifying a name that already exists will merge new fields on top of existing values.

    Client-certificate flags: --client-certificate=certfile --client-key=keyfile

    @@ -8176,16 +8222,16 @@ source $HOME/.bash_profile

    unset

    -

    Unset the current-context.

    +

    Unset the current-context

    kubectl config unset current-context
     
    -

    Unset namespace in foo context.

    +

    Unset namespace in foo context

    kubectl config unset contexts.foo.namespace
     
    -

    Unsets an individual value in a kubeconfig file

    +

    Unset an individual value in a kubeconfig file.

    PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.

    Usage

    $ kubectl config unset PROPERTY_NAME

    @@ -8196,18 +8242,18 @@ source $HOME/.bash_profile
    kubectl config use-context minikube
     
    -

    Sets the current-context in a kubeconfig file

    +

    Set the current-context in a kubeconfig file.

    Usage

    $ kubectl config use-context CONTEXT_NAME


    view

    -

    Show merged kubeconfig settings.

    +

    Show merged kubeconfig settings

    kubectl config view
     
    -

    Show merged kubeconfig settings and raw certificate data.

    +

    Show merged kubeconfig settings and raw certificate data

    kubectl config view --raw
     
    @@ -8293,7 +8339,7 @@ source $HOME/.bash_profile
    kubectl explain pods.spec.containers
     
    -

    List the fields for supported resources

    +

    List the fields for supported resources.

    This command describes the fields associated with each supported API resource. Fields are identified via a simple JSONPath identifier:

    <type>.<fieldName>[.<fieldName>]

    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.

    @@ -8374,7 +8420,7 @@ source $HOME/.bash_profile
    kubectl version
     
    -

    Print the client and server version information for the current context

    +

    Print the client and server version information for the current context.

    Usage

    $ kubectl version

    Flags