Kubernetes CLI Cheatsheet
Cheats
Get Nodes
Fetch a list of nodes in your cluster:
kubectl get nodes
This will output something like so:
NAME STATUS ROLES AGE VERSION
kube1.mydomain.com Ready control-plane 27d v1.32.0
kube2.mydomain.com NotReady control-plane 27d v1.32.0
kube3.mydomain.com Ready control-plane 27d v1.32.0
Get All
kubectl get all returns a list of pods, services, daemon sets, deployments, replica sets, jobs, cronjobs, and stateful sets. These are the built-in resource types.
kubectl get all
Delete Node
Run the following command to remove a node from your cluster. Be sure to have drained it first.
kubectl delete node kube2.home.programster.org
Get Pods Running On A Particular Node
NODE="kube1.mydomain.com"
kubectl get pods --all-namespaces -o wide --field-selector spec.nodeName=$NODE
References
Last updated: 12th February 2025
First published: 12th February 2025
First published: 12th February 2025