<p>I have an EKS cluster to which I've added support to work in hybrid mode (in other words, I've added Fargate profile to it). My intention is to run only specific workload on the AWS Fargate while keeping the EKS worker nodes for other kind of workload.</p>

<p>To test this out, my Fargate profile is defined to be:</p>

<ul>
<li>Restricted to specific namespace (Let's say: <strong>mynamespace</strong>)</li>
<li>Has specific label so that pods need to match it in order to be scheduled on Fargate (Label is: <strong>fargate: myvalue</strong>)</li>
</ul>

<p>For testing k8s resources, I'm trying to deploy simple nginx deployment which looks like this:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  namespace: mynamespace
  labels:
    fargate: myvalue
spec:
  selector:
    matchLabels:
      app: nginx
      version: 1.7.9
      fargate: myvalue
  replicas: 1
  template:
    metadata:
      labels:
        app: nginx
        version: 1.7.9
        fargate: myvalue
    spec:
      containers:
      - name: nginx
        image: nginx:1.7.9
        ports:
        - containerPort: 80
</code></pre>

<p>When I try to apply this resource, I get following:</p>

<pre><code>$ kubectl get pods -n mynamespace -o wide
NAME                                                        READY   STATUS      RESTARTS   AGE     IP            NODE                          NOMINATED NODE                                READINESS GATES
nginx-deployment-596c594988-x9s6n                           0/1     Pending     0          10m     &lt;none&gt;        &lt;none&gt;                        07c651ad2b-7cf85d41b2424e529247def8bda7bf38   &lt;none&gt;
</code></pre>

<p>Pod stays in the Pending state and it is never scheduled to the AWS Fargate instances.</p>

<p>This is a pod describe output:</p>

<pre><code>$ kubectl describe pod nginx-deployment-596c594988-x9s6n -n mynamespace
Name:               nginx-deployment-596c594988-x9s6n
Namespace:          mynamespace
Priority:           2000001000
PriorityClassName:  system-node-critical
Node:               &lt;none&gt;
Labels:             app=nginx
                    eks.amazonaws.com/fargate-profile=myprofile
                    fargate=myvalue
                    pod-template-hash=596c594988
                    version=1.7.9
Annotations:        kubernetes.io/psp: eks.privileged
Status:             Pending
IP:
Controlled By:      ReplicaSet/nginx-deployment-596c594988
NominatedNodeName:  9e418415bf-8259a43075714eb3ab77b08049d950a8
Containers:
  nginx:
    Image:        nginx:1.7.9
    Port:         80/TCP
    Host Port:    0/TCP
    Environment:  &lt;none&gt;
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-784d2 (ro)
Volumes:
  default-token-784d2:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-784d2
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  &lt;none&gt;
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:          &lt;none&gt;
</code></pre>

<p>One thing that I can conclude from this output is that correct Fargate profile was chosen:</p>

<pre><code>eks.amazonaws.com/fargate-profile=myprofile
</code></pre>

<p>Also, I see that some value is added to NOMINATED NODE field but not sure what it represents.</p>

<p>Any ideas or usual problems that happen and that might be worth troubleshooting in this case? Thanks</p>

<p>It turns out the problem was in networking setup of private subnets associated with the Fargate profile all the time. </p>

<p>To give more info, here is what I initially had:</p>

<ol>
<li>EKS cluster with several worker nodes where I've assigned only public subnets to the EKS cluster itself</li>
<li>When I tried to add Fargate profile to the EKS cluster, because of the current limitation on Fargate, it is not possible to associate profile with public subnets. In order to solve this, I've created private subnets with the same tag like the public ones so that EKS cluster is aware of them</li>
<li><p>What I forgot was that I needed to enable connectivity from the vpc private subnets to the outside world (I was missing NAT gateway). So I've created NAT gateway in Public subnet that is associated with EKS and added to the private subnets additional entry in their associated Routing table that looks like this:</p>

<p>0.0.0.0/0 nat-xxxxxxxx</p></li>
</ol>

<p>This solved the problem that I had above although I'm not sure about the real reason why AWS Fargate profile needs to be associated only with private subnets.</p>
