Search code examples
kubernetesamazon-eksamazon-vpceksctl

pod creation stuck in pending status for hours


This is my eksctl command to create a EKS cluster:

eksctl create cluster \
--name app \
--version 1.29 \
--region us-east-1 \
--nodegroup-name app-worker-group \
--node-type t2.micro \
--nodes 1 \
--vpc-cidr 172.31.0.0/16

After creation, I deploy a deployment like so:

kubectl apply -f k8s/deployment.yaml

Where the yaml file looks like this:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: app-api
  labels:
    app: app-api
spec:
  replicas: 1
  selector:
    matchLabels:
      app: app-api
  template:
    metadata:
      labels:
        app: app-api
    spec:
      containers:
        - name: app-api
          image: path/to/image
          ports:
            - containerPort: 2201 # port of the node js app

But the pod status is perpetually pending:

~/Documents/app kubectl get pod
NAME                       READY   STATUS    RESTARTS   AGE
app-api-785cbb9d89-vvbdf   0/1     Pending   0          11h

What could be the reason for this?

EDITED:

Events:
  Type     Reason            Age                 From               Message
  ----     ------            ----                ----               -------
  Warning  FailedScheduling  2m1s (x4 over 17m)  default-scheduler  0/1 nodes are available: 1 Too many pods. preemption: 0/1 nodes are available: 1 No preemption victims found for incoming pod.

Solution

  • ...0/1 nodes are available: 1 Too many pods

    Your cluster currently only has 1 node and the current running number of pods on this node --node-type t2.micro cannot run any more pods. You can add 1 more node to your cluster on the AWS Console > EKS > Compute (tab) > Node groups, goto the node group and click "Edit" to increase the "Desired size".