kubectl reference

kubectl reference

kubectl annotate Update the annotations on a resource
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 file name or stdin
  • kubectl apply edit-last-applied — Edit latest last-applied-configuration annotations of a resource/object
  • kubectl apply set-last-applied — Set the last-applied-configuration annotation on a live object to match the contents of a file
  • kubectl apply view-last-applied — View the latest last-applied-configuration annotations of a resource/object
kubectl attach Attach to a running container
kubectl auth Inspect authorization
  • kubectl auth can-i — Check whether an action is allowed
  • kubectl auth reconcile — Reconciles rules for RBAC role, role binding, cluster role, and cluster role binding objects
  • kubectl auth whoami — Experimental: Check self subject attributes
kubectl autoscale Auto-scale a deployment, replica set, stateful set, or replication controller
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 cluster information
  • kubectl cluster-info dump — Dump relevant information for debugging and diagnosis
kubectl completion Output shell completion code for the specified shell (bash, zsh, fish, or powershell)
kubectl config Modify kubeconfig files
  • kubectl config current-context — Display 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 delete-user — Delete the specified user from the kubeconfig
  • kubectl config get-clusters — Display clusters defined in the kubeconfig
  • kubectl config get-contexts — Describe one or many contexts
  • kubectl config get-users — Display users defined in the kubeconfig
  • kubectl config rename-context — Rename a context from the kubeconfig file
  • kubectl config set — Set an individual value in a kubeconfig file
  • kubectl config set-cluster — Set a cluster entry in kubeconfig
  • kubectl config set-context — Set a context entry in kubeconfig
  • kubectl config set-credentials — Set a user entry in kubeconfig
  • kubectl config unset — Unset an individual value in a kubeconfig file
  • kubectl config use-context — Set the current-context in a kubeconfig file
  • kubectl config view — Display merged kubeconfig settings or a specified kubeconfig file
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 cluster role
  • kubectl create clusterrolebinding — Create a cluster role binding for a particular cluster role
  • kubectl create configmap — Create a config map from a local file, directory or literal value
  • kubectl create cronjob — Create a cron job 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
  • kubectl create priorityclass — Create a priority class with the specified name
  • kubectl create quota — Create a quota with the specified name
  • kubectl create role — Create a role with single rule
  • kubectl create rolebinding — Create a role binding for a particular role or cluster role
  • kubectl create secret — Create a secret using a specified subcommand
  • kubectl create secret docker-registry — Create a secret for use with a Docker registry
  • kubectl create secret generic — Create a secret from a local file, directory, or literal value
  • kubectl create secret tls — Create a TLS secret
  • kubectl create service — Create a service using a specified subcommand
  • kubectl create service clusterip — Create a ClusterIP service
  • kubectl create service externalname — Create an ExternalName service
  • kubectl create service loadbalancer — Create a LoadBalancer service
  • kubectl create service nodeport — Create a NodePort service
  • kubectl create serviceaccount — Create a service account with the specified name
  • kubectl create token — Request a service account token
kubectl debug Create debugging sessions for troubleshooting workloads and nodes
kubectl delete Delete resources by file names, 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 the live version against a would-be applied version
kubectl drain Drain node in preparation for maintenance
kubectl edit Edit a resource on the server
kubectl events List events
kubectl exec Execute a command in a container
kubectl explain Get documentation for a resource
kubectl expose Take a replication controller, service, deployment or pod and expose it as a new Kubernetes service
kubectl get Display one or many resources
kubectl kuberc Manage kuberc configuration files
  • kubectl kuberc set — Set values in the kuberc configuration
  • kubectl kuberc view — Display the current kuberc configuration
kubectl kustomize Build a kustomization target from a directory or URL
kubectl label Update the labels on a resource
kubectl logs Print the logs for a container in a pod
kubectl options Print the list of flags inherited by all commands
kubectl patch Update fields of a resource
kubectl plugin Provides utilities for interacting with plugins
  • kubectl plugin list — List all visible plugin executables on a user's PATH
kubectl port-forward Forward one or more local ports to a pod
kubectl proxy Run a proxy to the Kubernetes API server
kubectl replace Replace a resource by file name or stdin
kubectl rollout Manage the rollout of a resource
  • kubectl rollout history — View rollout history
  • 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 — Undo a previous rollout
kubectl run Run a particular image on the cluster
kubectl scale Set a new size for a deployment, replica set, or replication controller
kubectl set Set specific features on objects
  • kubectl set env — Update environment variables on a pod template
  • kubectl set image — Update the image of a pod template
  • kubectl set resources — Update resource requests/limits on objects with pod templates
  • kubectl set selector — Set the selector on a resource
  • kubectl set serviceaccount — Update the service account of a resource
  • kubectl set subject — Update the user, group, or service account in a role binding or cluster role binding
kubectl taint Update the taints on one or more nodes
kubectl top Display resource (CPU/memory) usage
  • kubectl top node — Display resource (CPU/memory) usage of nodes
  • kubectl top pod — Display resource (CPU/memory) usage of pods
kubectl uncordon Mark node as schedulable
kubectl version Print the client and server version information
kubectl wait Wait for a specific condition on one or many resources