commands.sh

kubectl

all

Run commands against Kubernetes clusters. Some subcommands such as `run` have their own usage documentation.

More info →

Subcommands (38)

kubectl annotate

Annotates Kubernetes resources.

→
kubectl apply

Manage applications through files defining Kubernetes resources. Create and update resources in a cluster.

→
kubectl attach

Attach to a process that is already running inside an existing container.

→
kubectl auth

Inspect access permissions in a Kubernetes cluster.

→
kubectl autoscale

Create an autoscaler to intelligently scale pod count based on kubernetes cluster demands.

→
kubectl certificate

Manage certificate signing requests.

→
kubectl completion

Generate shell completion code for `kubectl` commands.

→
kubectl config

Manage Kubernetes configuration (kubeconfig) files for accessing clusters via `kubectl` or the Kubernetes API. By default, the Kubernetes will get its configuration from `${HOME}/.kube/config`. See also: `kubectx`, `kubens`.

→
kubectl cordon

Mark a node as unschedulable, preventing new pods from being assigned to it. See also: `kubectl uncordon`.

→
kubectl cp

Copy files and directories between a local filesystem and a container in a pod.

→
kubectl create

Create a resource from a file or from `stdin`.

→
kubectl debug

Debug cluster resources using interactive debugging containers.

→
kubectl delete

Delete Kubernetes resources.

→
kubectl describe

Show details of Kubernetes resources.

→
kubectl diff

Check differences between live resources and files.

→
kubectl drain

Drain a node in preparation for maintenance by marking it unschedulable and evicting all pods. See also: `kubectl cordon`, `kubectl uncordon`.

→
kubectl edit

Edit Kubernetes resources.

→
kubectl events

Display resource events.

→
kubectl exec

Execute a command in a container.

→
kubectl explain

Display the documentation of a Kubernetes API resource, including available fields and descriptions.

→
kubectl expose

Expose a resource as a new Kubernetes service.

→
kubectl get

Get Kubernetes objects and resources.

→
kubectl kustomize

Build a set of Kubernetes resources using a `kustomization.yaml` file.

→
kubectl label

Label Kubernetes resources.

→
kubectl logs

Show logs for containers in a pod.

→
kubectl patch

Patch Kubernetes resources with new values.

→
kubectl plugin

Manage kubectl plugins that extend the functionality of the command.

→
kubectl proxy

Create a proxy server or application-level gateway between localhost and the Kubernetes API server.

→
kubectl replace

Replace a resource by file or `stdin`.

→
kubectl rollout

Manage the rollout of a Kubernetes resource (deployments, daemonsets, and statefulsets).

→
kubectl run

Run pods in Kubernetes. Specifies pod generator to avoid deprecation error in some K8S versions.

→
kubectl scale

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

→
kubectl set

Update fields of existing application resources.

→
kubectl taint

Update the taints on nodes.

→
kubectl top

See the resource consumption for nodes or pods.

→
kubectl uncordon

Mark a node as schedulable, allowing new pods to be assigned to it. See also: `kubectl cordon`.

→
kubectl version

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

→
kubectl wait

Wait for resource(s) to reach a certain state.

→

Options (1)

-o, --outputboolean

List information about a resource with more details

Example: kubectl get {{pods|service|deployment|ingress|...}} {{[-o|--output]}} wide

Examples (8)

List information about a resource with more details

kubectl get pods|service|deployment|ingress|... [-o|--output] wide

Update specified pod with the label `unhealthy` and the value `true`

kubectl label pods name unhealthy=true

List all resources with different types

Display resource (CPU/Memory/Storage) usage of nodes or pods

kubectl top pods|nodes

Print the address of the master and cluster services

Display an explanation of a specific field

kubectl explain pods.spec.containers

Print the logs for a container in a pod or specified resource

kubectl logs pod_name

Run command in an existing pod

kubectl exec pod_name -- ls /
made by @shridhargupta | data from tldr-pages