<p>Tried creating node group inside the EKS cluster. After creating node group, inside add-ons, the core-dns option displays as degraded. Tried all possibilities found on google. Unable to resolve this. Can someone help on this.</p>

Naveen Kumar
<p>If you are using the AWS EKS Fargate then, you have to add the Labels while creating the coredns Fargate profile and in this way, the coredns will be able to find the nodes for its deployment and start working.
Here the steps:</p>
<ol>
<li><p>Let's get the pods available in the kube-system namespace.</p>
<p>kubectl get pods -n kube-system</p>
</li>
</ol>
<p>We can see that the coredns pods are stuck in a pending state.
<a href="https://i.stack.imgur.com/LjEGO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LjEGO.png" alt="Stuck in Pending state" /></a></p>
<ol start="2">
<li><p>Let's check why are they stuck in a pending state. (because there are no nodes available on the AWS EKS cluster to deploy coredns pods)</p>
<p>kubectl describe pods [pods_name] -n kube-system</p>
</li>
</ol>
<p><a href="https://i.stack.imgur.com/1MDVK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1MDVK.png" alt="Issue found" /></a></p>
<p>And if we scroll a bit up, we will be able to find the labels section of the particular pod.</p>
<p><a href="https://i.stack.imgur.com/G6ppN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/G6ppN.png" alt="Get the labels information" /></a></p>
<ol start="3">
<li>Now we will create a new Fargate pod and include the Label &quot;<strong>k8s-app</strong>=<strong>kube-dns</strong>&quot;. So that the coredns fargate profile can identify the particular Pods to deploy.
<a href="https://i.stack.imgur.com/aZE4k.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aZE4k.png" alt="Add the Labels to the coredns fargate profile" /></a></li>
</ol>
<p><a href="https://i.stack.imgur.com/cJawe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cJawe.png" alt="coredns fargate profile is now added" /></a></p>
<ol start="4">
<li><p>Now we will patch the coredns deployment using the following command:</p>
<p>kubectl patch deployment coredns <br />
-n kube-system <br />
--type json <br />
-p='[{&quot;op&quot;: &quot;remove&quot;, &quot;path&quot;: &quot;/spec/template/metadata/annotations/eks.amazonaws.com~1compute-type&quot;}]'</p>
</li>
</ol>
<p><a href="https://i.stack.imgur.com/vU3Cx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vU3Cx.png" alt="Coredns patched successfully" /></a></p>
<p>And we can see that our coredns pods have been started and running successfully
.
<a href="https://i.stack.imgur.com/oZlef.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oZlef.png" alt="Coredns pods working perfectly" /></a></p>
<ol start="5">
<li><p>We can also re-create the existing pods using the following command:</p>
<p>kubectl rollout restart -n kube-system deployment coredns
<a href="https://i.stack.imgur.com/A76oc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A76oc.png" alt="coredns restarted" /></a></p>
</li>
</ol>
<p>And our CoreDNS is healthy and Active now which was in a degraded state before.
<a href="https://i.stack.imgur.com/yxYsg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yxYsg.png" alt="Coredns addon is active now" /></a></p>
<p>You are now ready to rock with k8s on AWS. Best of Luck.</p>
