kubectl Basic Commands: get, describe, and list
You'll learn the three essential kubectl commands that let you see what's happening in your Kubernetes cluster.
The Core Information-Gathering Trio
Once you've configured kubectl and set your context, you need to inspect your cluster's resources. Think of these commands like different views of a library: get shows you titles on the shelf, describe pulls out a book's full details, and list (a variation of get) gives you the catalog.
kubectl get: The Quick Overview
The get command retrieves a summary of resources:
kubectl get pods
kubectl get services
kubectl get nodes
This shows a table with basic information—names, statuses, ages, and a few key metrics. It's your go-to command for quick cluster snapshots.
You can also target specific resources:
kubectl get pod my-pod-name
kubectl describe: Deep Dive Details
When get isn't enough, describe provides extensive information about a specific resource:
kubectl describe pod my-pod-name
kubectl describe node worker-node-1
This displays configuration details, events, status conditions, and recent activity—invaluable for troubleshooting. It's like opening that book and reading every detail inside.
Understanding "list"
The list term often refers to using get with resource types that return multiple items. There's no separate list command—it's the plural behavior of get:
kubectl get pods # Lists all pods
kubectl get services # Lists all services
These commands work with the API Server you learned about earlier, querying cluster state stored in etcd.
Key Takeaway: kubectl get provides quick summaries of resources, kubectl describe reveals detailed information about specific objects, and both commands are your primary tools for inspecting cluster state.