Subcommands100 subcommands
kubectl alpha
These commands correspond to alpha features that are not enabled in Kubernetes clusters by default
kubectl alpha debug
Tools for debugging Kubernetes resources
kubectl annotate
Update the annotations on one or more resources
kubectl api-resources
Print the supported API resources on the server
kubectl api-versions
Print the supported API versions on the server, in the form of "group/version"
kubectl apply
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'
kubectl apply edit-last-applied
Edit the latest last-applied-configuration annotations of resources from the default editor
kubectl apply set-last-applied
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<file> ' was run, without updating any other parts of the object
kubectl apply view-last-applied
View the latest last-applied-configuration annotations by type/name or file
kubectl attach
Attach to a process that is already running inside an existing container
kubectl auth
Inspect authorization
kubectl auth can-i
Check whether an action is allowed
kubectl auth reconcile
Reconciles rules for RBAC Role, RoleBinding, ClusterRole, and ClusterRole binding objects
kubectl autoscale
Creates an autoscaler that automatically chooses and sets the number of pods that run in a kubernetes cluster
kubectl certificate
Modify certificate resources
kubectl certificate approve
Approve a certificate signing request
kubectl certificate deny
Deny a certificate signing request
kubectl cluster-info
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'
kubectl cluster-info dump
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
kubectl completion
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
kubectl config
Modify kubeconfig files using subcommands like "kubectl config set current-context my-context"
kubectl config current-context
Displays the current-context
kubectl config delete-cluster
Delete the specified cluster from the kubeconfig
kubectl config delete-context
Delete the specified context from the kubeconfig
kubectl config get-clusters
Display clusters defined in the kubeconfig
kubectl config get-contexts
Displays one or many contexts from the kubeconfig file
kubectl config get-users
Display users defined in the kubeconfig
kubectl config rename-context
Renames a context from the kubeconfig file
kubectl config set
Sets an individual value in a kubeconfig file
kubectl config set-cluster
Sets a cluster entry in kubeconfig
kubectl config set-context
Sets a context entry in kubeconfig
kubectl config set-credentials
Sets a user entry in kubeconfig
kubectl config unset
Unsets an individual value in a kubeconfig file
kubectl config use-context
Sets the current-context in a kubeconfig file
kubectl config view
Display merged kubeconfig settings or a specified kubeconfig file
kubectl convert
Convert config files between different API versions. Both YAML and JSON formats are accepted
kubectl cordon
Mark node as unschedulable
kubectl cp
Copy files and directories to and from containers
kubectl create
Create a resource from a file or from stdin
kubectl create clusterrole
Create a ClusterRole
kubectl create clusterrolebinding
Create a ClusterRoleBinding for a particular ClusterRole
kubectl create configmap
Create a configmap based on a file, directory, or specified literal value
kubectl create cronjob
Create a cronjob with the specified name
kubectl create deployment
Create a deployment with the specified name
kubectl create ingress
Create an ingress with the specified name
kubectl create job
Create a job with the specified name
kubectl create namespace
Create a namespace with the specified name
kubectl create poddisruptionbudget
Create a pod disruption budget with the specified name, selector, and desired minimum available pods
kubectl create priorityclass
Create a priorityclass with the specified name, value, globalDefault and description
kubectl create quota
Create a resourcequota with the specified name, hard limits and optional scopes
kubectl create role
Create a role with single rule
kubectl create rolebinding
Create a RoleBinding for a particular Role or ClusterRole
kubectl create secret
Create a secret using specified subcommand
kubectl create secret docker-registry
Create a new secret for use with Docker registries
kubectl create secret generic
Create a secret based on a file, directory, or specified literal value
kubectl create secret tls
Create a TLS secret from the given public/private key pair
kubectl create service
Create a service using specified subcommand
kubectl create service clusterip
Create a ClusterIP service with the specified name
kubectl create service externalname
Create an ExternalName service with the specified name
kubectl create service loadbalancer
Create a LoadBalancer service with the specified name
kubectl create service nodeport
Create a NodePort service with the specified name
kubectl create serviceaccount
Create a service account with the specified name
kubectl delete
Delete resources by filenames, stdin, resources and names, or by resources and label selector
kubectl describe
Show details of a specific resource or group of resources
kubectl diff
Diff configurations specified by filename or stdin between the current online configuration, and the configuration as it would be if applied
kubectl drain
Drain node in preparation for maintenance
kubectl edit
Edit a resource from the default editor
kubectl exec
Execute a command in a container
kubectl explain
List the fields for supported resources
kubectl expose
Expose a resource as a new Kubernetes service
kubectl get
Display one or many resources
kubectl kustomize
Print a set of API resources generated from instructions in a kustomization.yaml file
kubectl label
Update the labels on a resource
kubectl logs
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional
kubectl patch
Update field(s) of a resource using strategic merge patch, a JSON merge patch, or a JSON patch
kubectl plugin
Provides utilities for interacting with plugins
kubectl port-forward
Forward one or more local ports to a pod. This command requires the node to have 'socat' installed
kubectl proxy
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
kubectl replace
Replace a resource by filename or stdin
kubectl rollout
Manage the rollout of a resource
kubectl rollout history
View previous rollout revisions and configurations
kubectl rollout pause
Mark the provided resource as paused
kubectl rollout restart
Restart a resource
kubectl rollout resume
Resume a paused resource
kubectl rollout status
Show the status of the rollout
kubectl rollout undo
Rollback to a previous rollout
kubectl run
Create and run a particular image in a pod
kubectl scale
Set a new size for a Deployment, ReplicaSet, Replication Controller, or StatefulSet
kubectl set
Configure application resources
kubectl set env
Update environment variables on a pod template
kubectl set image
Update existing container image(s) of resources
kubectl set resources
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
kubectl set selector
Set the selector on a resource. Note that the new selector will overwrite the old selector if the resource had one prior to the invocation of 'set selector'
kubectl set serviceaccount
Update ServiceAccount of pod template resources
kubectl set subject
Update User, Group or ServiceAccount in a RoleBinding/ClusterRoleBinding
kubectl taint
Update the taints on one or more nodes
kubectl top
Display Resource (CPU/Memory/Storage) usage
kubectl uncordon
Mark node as schedulable
kubectl version
Print the client and server version information for the current context
kubectl wait
Experimental: Wait for a specific condition on one or many resources