<p>I am building an AWS EKS cluster using <a href="https://github.com/terraform-aws-modules/terraform-aws-eks" rel="nofollow noreferrer">this Terraform provider</a>. However, I can't find a way to apply node taints to managed node groups or worker groups. <a href="https://github.com/aws/containers-roadmap/issues/864" rel="nofollow noreferrer">This issue and its resolution</a> seem to suggest that this is not possible. Is there any way to do this?</p>

ramdesh
<p>In the Terraform script for that provider, you can add the following to a worker group:</p>
<p>(in <code>main.tf</code>)</p>
<pre><code>worker_groups = [
  {
      name                          = &quot;my_node_group&quot;
      instance_type                 = &quot;t3.medium&quot;
      asg_desired_capacity          = 1
      asg_min_size                  = 1
      additional_security_group_ids = [aws_security_group.all_worker_mgmt.id]
      kubelet_extra_args            = &quot;--node-labels=my_node_label --register-with-taints=my_node_label:NoSchedule&quot;
      asg_max_size                  = 1
      tags = []
    },
]
</code></pre>
<p>The important part is to set <code>kubelet_extra_args</code> to apply a node label to the node and to use that node label to set the taint using <code>--register-with-taints</code>. These are commands run by EKS on each worker node at startup. (Note that all the other parameters I have set in the worker group can be changed based on your requirement)</p>
<p>You can check taints on nodes by using <code>kubectl describe node &lt;node_ip&gt;</code>.</p>
