kubectl 1.37 cheatsheet

kubectl 1.37: Viewing resources

10 common kubectl 1.37 tasks.

List pods

Show pods in the current namespace.

kubectl get pods

List pods in all namespaces

Show pods across the whole cluster.

kubectl get pods -A

List pods with node and IP

Add the node, pod IP and other columns.

kubectl get pods -o wide

Watch pods change

Keep the list open and print updates.

kubectl get pods -w

List common resources

Show pods, services, deployments and other workloads in the namespace.

kubectl get all

Show a resource as YAML

Print the live definition of a resource.

kubectl get deployment web -o yaml

Describe a resource

Show its details and recent events. Start here when a pod won't start.

kubectl describe pod web-7d9f8c6b5-abcde

Show recent events

List events, oldest first.

kubectl get events --sort-by=.metadata.creationTimestamp

Show CPU and memory use

Needs metrics-server installed in the cluster.

kubectl top pods

List resource types

Show every resource type the cluster supports.

kubectl api-resources

Was this page helpful?