Scroll to navigation

KUBECTL(1) User Commands KUBECTL(1)

NAME

kubectl - Command-line tool for interacting with a Kubernetes cluster's control plane

DESCRIPTION

kubectl controls the Kubernetes cluster manager.

Find more information at: https://kubernetes.io/docs/reference/kubectl/

Basic Commands (Beginner):

Create a resource from a file or from stdin
Take a replication controller, service, deployment or pod and expose it as a new Kubernetes service
Run a particular image on the cluster
Set specific features on objects

Basic Commands (Intermediate):

Get documentation for a resource
Display one or many resources
Edit a resource on the server
Delete resources by file names, stdin, resources and names, or by resources and label selector

Deploy Commands:

Manage the rollout of a resource
Set a new size for a deployment, replica set, or replication controller
Auto-scale a deployment, replica set, stateful set, or replication controller

Cluster Management Commands:

Modify certificate resources
Display cluster information
Display resource (CPU/memory) usage
Mark node as unschedulable
Mark node as schedulable
Drain node in preparation for maintenance
Update the taints on one or more nodes

Troubleshooting and Debugging Commands:

Show details of a specific resource or group of resources
Print the logs for a container in a pod
Attach to a running container
Execute a command in a container
Forward one or more local ports to a pod
Run a proxy to the Kubernetes API server
Copy files and directories to and from containers
Inspect authorization
Create debugging sessions for troubleshooting workloads and nodes
List events

Advanced Commands:

Diff the live version against a would-be applied version
Apply a configuration to a resource by file name or stdin
Update fields of a resource
Replace a resource by file name or stdin
Experimental: Wait for a specific condition on one or many resources
Build a kustomization target from a directory or URL

Settings Commands:

Update the labels on a resource
Update the annotations on a resource
Output shell completion code for the specified shell (bash, zsh, fish, or powershell)

Subcommands provided by plugins:

Other Commands:

Print the supported API resources on the server
Print the supported API versions on the server, in the form of "group/version"
Modify kubeconfig files
Provides utilities for interacting with plugins
Print the client and server version information

Usage:

kubectl [flags] [options]

Use "kubectl <command> --help" for more information about a given command. Use "kubectl options" for a list of global command-line options (applies to all commands).

March 2025 kubectl v1.32.3