0
0
Kubernetesdevops~20 mins

Pod stuck in Pending state in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Pod Pending State Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why is a Kubernetes Pod stuck in Pending state?

A Pod in Kubernetes is stuck in the Pending state. What is the most common reason for this?

AThere are not enough resources available on any node to schedule the Pod.
BThe Pod's container image is missing from the registry.
CThe Pod's network policy is blocking all traffic.
DThe Pod has completed its task and is terminating.
Attempts:
2 left
💡 Hint

Think about what the scheduler needs to place a Pod on a node.

💻 Command Output
intermediate
2:00remaining
Identify the cause from Pod describe output

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.
AThe Pod's container image is not found.
BThe Pod is waiting for a volume to be attached.
CThe Pod requests more memory than any node has available.
DThe Pod's service account is missing.
Attempts:
2 left
💡 Hint

Look at the 'FailedScheduling' message carefully.

Troubleshoot
advanced
2:00remaining
Fixing a Pod stuck in Pending due to node selector mismatch

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?

Akubectl logs mypod
Bkubectl describe pod mypod
Ckubectl get pods --all-namespaces
Dkubectl get nodes --show-labels
Attempts:
2 left
💡 Hint

You need to check node labels to match the nodeSelector.

🔀 Workflow
advanced
3:00remaining
Order the steps to diagnose a Pending Pod due to resource constraints

Put the following steps in the correct order to diagnose why a Pod is stuck in Pending due to resource constraints.

A1,3,2,4
B3,1,2,4
C1,3,4,2
D3,2,1,4
Attempts:
2 left
💡 Hint

Start by checking Pod events, then resource requests, then node details, then compare.

Best Practice
expert
2:00remaining
Preventing Pods from getting stuck in Pending state

Which practice helps prevent Pods from getting stuck in Pending state due to resource shortages?

AUse hostPath volumes to store Pod data on the node.
BAlways set resource requests and limits for Pods to help the scheduler make decisions.
CDisable the Kubernetes scheduler and assign Pods manually.
DSet Pod restartPolicy to Never.
Attempts:
2 left
💡 Hint

Think about how the scheduler decides where to place Pods.