Full lesson
Explore the full explanation, examples, and visuals at your own pace.
Before: ten minutes of Pending, no reason given
kubectl get tells you what. describe tells you why. Here, get shows one line: web-app, zero of one ready, status Pending, ten minutes old. It's been that way the whole time, and nothing on this line says what's wrong. The status names the state, but not the reason.
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
web-app 0/1 Pending 0 10mAfter: the Events section at the bottom explains why
Run kubectl describe and scroll past the details to Events at the bottom. There's a Warning from the default-scheduler, the component that picks a node, meaning a machine, for your Pod. It says zero of three nodes are available, because all three have insufficient memory.
$ kubectl describe pod web-app
Name: web-app
Status: Pending
...
Events:
Type Reason From Message
Warning FailedScheduling default-scheduler 0/3 nodes are available:
3 Insufficient memory.What Kubernetes tried, written into Events
Here's what happened behind that message. Pod web-app needed a node, so the scheduler checked all three nodes for enough free memory. None fit, and it wrote that failure into Events. So the fix is clear: lower the memory request, or add capacity to the cluster.
The answer was there. It was just at the bottom.
When a status looks stuck, run kubectl describe and read Events first. The answer was there. It was just at the bottom.