Skip to content

[Bug] CoreDNS scheduling on Fargate fails when label in selector  #8355

@naclonts

Description

@naclonts

What were you trying to accomplish?

Create an EKS cluster using eksctl with both Fargate profiles and CoreDNS addons defined in the configuration file, including the label eks.amazonaws.com/component: coredns in the Fargate profile selector. Expected CoreDNS pods to be scheduled on Fargate nodes based on the Fargate profile selectors.

What happened?

CoreDNS pods are created and scheduled before the Fargate profile becomes active, causing them to remain in Pending state since there are no EC2 nodes. Manual restart of CoreDNS pods is required after cluster creation to get them scheduled on Fargate nodes.

Note this only seems to happen when the fargateProfiles selector contains a label. If all labels are removed from the selector, eksctl takes an extra step to schedule the CoreDNS addon after Fargate setup is complete.

How to reproduce it?

  1. Create a cluster config file (cluster.yaml):
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
  name: cluster-name
  region: us-west-2
fargateProfiles:
  - name: main
    selectors:
      - namespace: kube-system
        labels:
          eks.amazonaws.com/component: coredns
  1. Create cluster:
eksctl create cluster -f cluster.yaml
  1. Observe CoreDNS pods in Pending state until manually restarted with:
kubectl rollout restart deployment coredns -n kube-system

Logs

With selectors label (using config file above)

cluster create logs:

...
2025-04-17 20:24:27 [ℹ]  creating addon: coredns
2025-04-17 20:24:28 [ℹ]  successfully created addon: coredns
2025-04-17 20:26:28 [ℹ]  creating Fargate profile "main" on EKS cluster "cluster-name"
...

CoreDNS status until restarting deployment:

kubectl get pods -n kube-system
NAME                       READY   STATUS    RESTARTS   AGE
coredns-xxxxxx-xxxxx      0/1     Pending   0          2m
coredns-xxxxxx-xxxxx      0/1     Pending   0          2m

Without selectors label

eksctl create cluster --name a17y --fargate
2025-04-17 20:33:49 [ℹ]  default addons coredns, metrics-server, vpc-cni, kube-proxy were not specified, will install them as EKS addons
2025-04-17 20:33:49 [ℹ]  
2 sequential tasks: { create cluster control plane "a17y", 
    3 sequential sub-tasks: { 
        1 task: { create addons },
        wait for control plane to become ready,
        create fargate profiles,
    } 
}
...
2025-04-17 20:41:50 [ℹ]  creating addon: coredns
2025-04-17 20:41:51 [ℹ]  successfully created addon: coredns
...
2025-04-17 20:43:53 [ℹ]  creating Fargate profile "fp-default" on EKS cluster "a17y"
2025-04-17 20:48:10 [ℹ]  created Fargate profile "fp-default" on EKS cluster "a17y"
2025-04-17 20:48:40 [ℹ]  "coredns" is now schedulable onto Fargate
2025-04-17 20:49:44 [ℹ]  "coredns" is now scheduled onto Fargate
2025-04-17 20:49:44 [ℹ]  "coredns" pods are now scheduled onto Fargate
...
2025-04-17 20:49:44 [✔]  EKS cluster "a17y" in "us-west-2" region is ready

CoreDNS pods show Running status:

k get all -A
NAMESPACE     NAME                                  READY   STATUS    RESTARTS   AGE
kube-system   pod/coredns-68fc64c5d7-fpbc9          1/1     Running   0          44m
kube-system   pod/coredns-68fc64c5d7-x428m          1/1     Running   0          44m

Versions

$ eksctl info
eksctl version: 0.207.0
kubectl version: v1.32.2
OS: linux

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions