0
0
Kubernetesdevops~30 mins

Pod stuck in Pending state in Kubernetes - Mini Project: Build & Apply

Choose your learning style9 modes available
Troubleshooting a Pod Stuck in Pending State
📖 Scenario: You are managing a Kubernetes cluster for a small web application. One of your pods is stuck in the Pending state, which means it is not starting properly. You want to find out why and fix the issue so your application runs smoothly.
🎯 Goal: Learn how to check the pod status, understand why a pod might be stuck in Pending, and fix the problem by adjusting resource requests or node selectors.
📋 What You'll Learn
Use kubectl commands to check pod status
Inspect pod events to find the cause of Pending state
Modify pod configuration to fix resource or scheduling issues
Apply the fixed configuration and verify pod starts running
💡 Why This Matters
🌍 Real World
Pods stuck in Pending state are common when cluster resources are limited or pod specs are too demanding. Fixing these issues quickly keeps applications available.
💼 Career
DevOps engineers and Kubernetes administrators often troubleshoot pod scheduling problems to maintain healthy application deployments.
Progress0 / 4 steps
1
Check Pod Status
Use the command kubectl get pod myapp-pod to check the status of the pod named myapp-pod.
Kubernetes
Need a hint?

Use kubectl get pod followed by the pod name to see its current status.

2
Inspect Pod Events
Use the command kubectl describe pod myapp-pod to see detailed information and events for the pod myapp-pod. Look for messages explaining why it is Pending.
Kubernetes
Need a hint?

The kubectl describe pod command shows events like scheduling failures or resource shortages.

3
Fix Pod Resource Requests
Edit the pod configuration YAML to reduce the resources.requests.cpu value to 100m and resources.requests.memory to 128Mi. This helps if the pod is Pending due to insufficient resources.
Kubernetes
Need a hint?

Open the pod YAML and find the resources.requests section. Change the CPU and memory values as instructed.

4
Apply Changes and Verify Pod Runs
Apply the updated pod configuration using kubectl apply -f pod.yaml. Then check the pod status again with kubectl get pod myapp-pod to confirm it is now Running.
Kubernetes
Need a hint?

Use kubectl apply -f pod.yaml to update the pod, then kubectl get pod myapp-pod to see if it is Running.