Microk8s pods are stuck on pending on Ubuntu
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Exploring Pending MicroK8s Pods on Ubuntu: Troubleshooting and Resolutions
When using MicroK8s on Ubuntu, a common issue that users encounter is pods being stuck in the "Pending" state. This situation arises due to various factors that interfere with the successful scheduling and running of pods. Understanding why this happens and how to troubleshoot can significantly aid in managing a healthy Kubernetes environment.
Understanding What MicroK8s is
MicroK8s is a lightweight, fast, and convenient Kubernetes distribution by Canonical, tailored primarily for IoT devices and edge computing applications. It's often chosen for its ease of installation and minimal system resource requirements, making it a popular choice for development environments on Ubuntu.
Reasons for Pods Being Stuck in Pending
There are multiple reasons why a pod might be stuck in the Pending state. This typically occurs because the pod cannot be scheduled onto any node within the cluster. Here are the main causes:
- Resource Constraints:
- Nodes may lack sufficient CPU or memory resources to schedule the pod.
- By default, Kubernetes scheduling priorities aim to bind pods that fit resource availability on nodes.
- Node Unschedulability:
- Nodes might be marked as unschedulable if they are under maintenance or unavailable.
- Taints and Affinities:
- Pods that don't tolerate certain node taints or don't meet defined affinity rules might remain unschedulable.
- Network Plugin Issues:
- CNI plugin misconfigurations can prevent pod networking from being established.
- Persistent Volume Claims (PVC) Issues:
- Pending PVCs that pods depend on block pods from starting.
Troubleshooting Steps
Here are practical steps to resolve nodes stuck in Pending when using MicroK8s on Ubuntu:
1. Check Available Resources
Ensure that your nodes have enough resources.
- Look for indications that nodes lack sufficient CPU or memory.
- Use `microk8s kubectl cordon ``<node-name>``` and `microk8s kubectl uncordon ``<node-name>``` to adjust node schedulability.
- Look for Events suggesting resource limits, node readiness, or scheduling issues.
- Ensure that your pod spec includes necessary tolerations.
- Use `microk8s enable dns` and `microk8s enable ``<networking-plugin>``` as needed.
- Investigate pending PVCs and their associated storage classes.
Related reading
- Microk8s remote with kubectl You must be logged in to the server Unauthorized
- Migrate a Kubernetes application to GCP from AWS
- minikube - how to access pod via pod ip using curl
- minikube and how to debug api server error
- Micronaut Kafka Health check fails with Cluster authorization failed
- ''Microsoft.ACE.OLEDB.12.0'' provider is not registered on the local machine
- Minikube can't pull a container from ECR
- Minikube dashboard and any other pods won't schedule

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.