<p>So I created an EKS cluster for Fargate with the following manifest, and it created ok. I want to run applications in Fargate, not in EC2 worker nodes, so I didn't create node groups (correct?).</p>
<pre><code>$ eksctl create -f cluster.yaml
cluster.yaml
------------
metadata:
  name: sandbox
  region: us-east-1
  version: &quot;1.18&quot;

fargateProfiles:
  - name: fp-default
    selectors:
      # All workloads in the &quot;default&quot; Kubernetes namespace will be
      # scheduled onto Fargate:
      - namespace: default
      # All workloads in the &quot;kube-system&quot; Kubernetes namespace will be
      # scheduled onto Fargate:
      - namespace: kube-system
  - name: fp-sandbox
    selectors:
      # All workloads in the &quot;sandbox&quot; Kubernetes namespace matching the
      # following label selectors will be scheduled onto Fargate:
      - namespace: sandbox
        labels:
          env: sandbox
          checks: passed

$ kubectl get nodes
NAME                                     STATUS   ROLES    AGE    VERSION
fargate-ip-192-168-100-23.ec2.internal   Ready    &lt;none&gt;   3h2m   v1.18.8-eks-7c9bda
fargate-ip-192-168-67-135.ec2.internal   Ready    &lt;none&gt;   3h2m   v1.18.8-eks-7c9bda
</code></pre>
<p>Then I created a namespace</p>
<pre><code>$ kubectl create namespace sandbox
</code></pre>
<p>Now I create a deployment in the <code>sandbox</code> namespace to match the namespace in my <code>fp-sandbox</code> Fargate profile, and is stuck in <code>Pending</code> state</p>
<pre><code>$ kubectl create deploy hello-world-node --image=redacted.dkr.ecr.us-east-1.amazonaws.com/hello-world-node:latest --namespace=sandbox
$ kubectl get po -n sandbox
NAME                                READY   STATUS    RESTARTS   AGE
hello-world-node-544748b68b-4bghr   0/1     Pending   0          18m

$ kubectl describe pod hello-world-node-544748b68b-4bghr -n sandbox
....
Events:
Type     Reason            Age                 From               Message
----     ------            ----                ----               -------
Warning  FailedScheduling  12s (x15 over 19m)  default-scheduler  0/2 nodes are available: 2 Too many pods.
</code></pre>
<p>Why does it say <code>0/2 nodes are available</code>? What am I missing? Remember I want to run the application in Fargate, not in EC2 worker nodes.</p>
<p>NOTE: I can run the container locally. It's just a simple NodeJS app that echoes &quot;Hello World.&quot;</p>
<p><strong>UPDATE</strong>: I added a <code>manageNodeGroups</code> to my cluster, and the pod came up. However, why so? Why didn't the pods run in Fargate, without the node group?</p>

Chris F
<p>@Chris, hi again :)</p>
<p>In your YAML file</p>
<pre class="lang-yaml prettyprint-override"><code>      # All workloads in the &quot;sandbox&quot; Kubernetes namespace matching the
      # following label selectors will be scheduled onto Fargate:
</code></pre>
<p>There's an <code>AND</code> condition between the two sentences above, so your pods should be assigned with <code>env=sandbox</code> and <code>checks=passed</code> labels.</p>
<p>A quick fix</p>
<pre class="lang-sh prettyprint-override"><code>kubectl --namespace sandbox label pods --all env=sandbox
kubectl --namespace sandbox label pods --all checks=passed
</code></pre>
<p>A better way to fix it is by writing a deployment.yaml file and add the labels in the relevant place.</p>
<h2>References</h2>
<ul>
<li><a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#label" rel="nofollow noreferrer">Kubernetes API Label</a></li>
<li><a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/" rel="nofollow noreferrer">Labels and Selectors</a></li>
<li><a href="https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/controllers/nginx-deployment.yaml" rel="nofollow noreferrer">nginx deployment.yaml example</a></li>
</ul>
