<p>I'm still a noob, so go gentle on me please!</p>
<p>I have an eks cluster running with this node group configs:</p>
<pre><code>resource &quot;aws_eks_node_group&quot; &quot;this&quot; {
  cluster_name    = aws_eks_cluster.this.name
  node_group_name = local.cluster_name
  node_role_arn   = aws_iam_role.eks_node.arn
  subnet_ids      = aws_subnet.this.*.id
  instance_types  = [&quot;t2.micro&quot;]

  scaling_config {
    desired_size = 2
    max_size     = 4
    min_size     = 2
  }

  # Optional: Allow external changes without Terraform plan difference
  lifecycle {
    ignore_changes = [scaling_config[0].desired_size]
  }

  depends_on = [
    aws_iam_role_policy_attachment.eks_AmazonEKSWorkerNodePolicy,
    aws_iam_role_policy_attachment.eks_AmazonEKS_CNI_Policy,
    aws_iam_role_policy_attachment.eks_AmazonEC2ContainerRegistryReadOnly,
  ]
}
</code></pre>
<p>my scaling configs are:</p>
<pre><code>  scaling_config {
    desired_size = 2
    max_size     = 4
    min_size     = 2
  }
</code></pre>
<p>and I successfully can deploy <code>2</code> nginx replicas with the following configs:</p>
<pre><code>resource &quot;kubernetes_deployment&quot; &quot;nginx&quot; {
  metadata {
    name = &quot;nginx&quot;
    labels = {
      App = &quot;Nginx&quot;
    }
  }

  spec {
    replicas = 2
    selector {
      match_labels = {
        App = &quot;Nginx&quot;
      }
    }
    template {
      metadata {
        labels = {
          App = &quot;Nginx&quot;
        }
      }
      spec {
        container {
          image = &quot;nginx:1.7.8&quot;
          name  = &quot;nginx&quot;

          port {
            container_port = 80
          }

          resources {
            limits = {
              cpu    = &quot;0.5&quot;
              memory = &quot;512Mi&quot;
            }
            requests = {
              cpu    = &quot;250m&quot;
              memory = &quot;50Mi&quot;
            }
          }
        }
      }
    }
  }
}
</code></pre>
<p>but when I scale my replicas to <code>4</code> the pods are created but in a pending state with the following reason:</p>
<pre><code>Events:
  Type     Reason            Age                 From               Message
  ----     ------            ----                ----               -------
  Warning  FailedScheduling  18s (x2 over 108s)  default-scheduler  0/2 nodes are available: 2 Too many pods.
</code></pre>
<p>I tried ignoring <code>desired_size</code> in <code>scaling_config</code> but didn't help to resolve the issue.</p>
<p>I believe I'm missing a crucial understanding working with scaling_config and the scaling group that it creates and k8s deployment replicas. Any guidance to help me understand what's going on, will be highly appreciated. Thanks a lot In advance.</p>
<p><a href="https://github.com/ehabshaaban/deploy-nginx/tree/eks" rel="nofollow noreferrer">https://github.com/ehabshaaban/deploy-nginx/tree/eks</a></p>

<p>according to the message <code>0/2 nodes are available: 2 Too many pods.</code>, you can find the node can not be placed any pods. In EKS, the number of max pods could be placed in the node would based on several things <code>instance type</code> &amp; <code>cni</code>. By default, you can refer this document <a href="https://github.com/awslabs/amazon-eks-ami/blob/master/files/eni-max-pods.txt" rel="noreferrer">eni-max-pod</a></p>
<p>To solve your issue, you can increase the <code>desired_size</code> from 2 to 3. So the pods would be placed to the new nodes.</p>
