Skip to main content

Kubectl Cheats

Cheat sheet for kubectl commands.

info

This page was automatically generated from a navi cheat file available at difranca/navi-cheats.
Navi is an interactive cheatsheet tool for the command-line. To learn more about it, visit denisidoro/navi.


Configโ€‹

Set which Kubectl cluster kubectl communicates with and modify configuration information.

CommandDescription
kubectl config viewShow Merged kubeconfig settings
kubectl config get-contextsDisplay list of contexts
kubectl config current-contextDisplay the current-context
kubectl config use-context {context-name}Set the default context to my-cluster-name

Createโ€‹

Manage applications through files.

CommandDescription
kubectl create -f {filename}Create resource(s) from file
kubectl apply -f {filename}Create or modify resource(s) from file

List Resourcesโ€‹

List resources from cluster.

CommandDescription
kubectl get {resource} -n {namespace}List namespace-scoped resources
kubectl get {resource}List cluster-scoped resources

Administrationโ€‹

Interacting with nodes and cluster.

CommandDescription
kubectl cordon {node_name}Mark node as unschedulable
kubectl uncordon {node_name}Mark my-node as schedulable
kubectl drain {node_name}Drain node in preparation for maintenance
kubectl cluster-infoDisplay cluster information