A Pod in Kubernetes is stuck in the Pending state. What is the most common reason for this?
Think about what the scheduler needs to place a Pod on a node.
A Pod stays in Pending state if Kubernetes cannot find a node with enough CPU, memory, or other requested resources to run it.
Given the following snippet from kubectl describe pod mypod, what is the cause of the Pod being Pending?
Events: Type Reason Age From Message ---- ------ ---- ---- ------- Warning FailedScheduling 2m (x3 over 5m) default-scheduler 0/3 nodes are available: 3 Insufficient memory.
Look at the 'FailedScheduling' message carefully.
The scheduler reports 'Insufficient memory' meaning no node has enough free memory to run the Pod.
You deployed a Pod with a nodeSelector that does not match any node labels. Which command will help you verify node labels to fix this issue?
You need to check node labels to match the nodeSelector.
The command kubectl get nodes --show-labels lists all nodes with their labels, helping you verify if the nodeSelector matches any node.
Put the following steps in the correct order to diagnose why a Pod is stuck in Pending due to resource constraints.
Start by checking Pod events, then resource requests, then node details, then compare.
First, check Pod events to see scheduling errors. Then verify Pod resource requests. Next, check node resources. Finally, compare requests to availability to find the mismatch.
Which practice helps prevent Pods from getting stuck in Pending state due to resource shortages?
Think about how the scheduler decides where to place Pods.
Setting resource requests and limits allows the scheduler to allocate Pods only to nodes with enough resources, preventing Pending state due to resource shortages.