Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add taint to AWS EKS node Group?

I am having one AWS EKS Cluster up & running. I need to add node group with taint. So that I can deploy the pod on particular node group in EKS. I can do it in azure AKS using the following command.

az aks nodepool add --resource-group rg-xx --cluster-name aks-xxx --name np1 --node-count 1 --node-vm-size xxx --node-taints key=value:NoSchedule --no-wait

How to achieve same in AWS EKS?

like image 998
deepak Avatar asked Oct 15 '25 22:10

deepak


2 Answers

You can use this example: https://eksctl.io/usage/autoscaling/#scaling-up-from-0

nodeGroups:
- name: ng1-public
  ...
  labels:
    my-cool-label: pizza
  taints:
    feaster: "true:NoSchedule"
like image 157
pb100 Avatar answered Oct 17 '25 11:10

pb100


if you are using eksctl with managed nodegroups, you can patch the bootstrap script to achieve what you want.

managedNodeGroups:
  - name: batch
    preBootstrapCommands:
      - sed -i '/^KUBELET_EXTRA_ARGS=/a KUBELET_EXTRA_ARGS+=" --register-with-taints=tier=batch:NoSchedule"' /etc/eks/bootstrap.sh
    tags:
      k8s.io/cluster-autoscaler/node-template/taint/tier: "batch:NoSchedule"

this relies on the code at https://github.com/awslabs/amazon-eks-ami/blob/189baaa77c14120a1b62c42bacced17ba429466b/files/bootstrap.sh#L107 not changing too much.

You can similarly enable the docker network bridge (aka --enable-docker-bridge)

    preBootstrapCommands:
      - sed -i 's/^ENABLE_DOCKER_BRIDGE=.*/ENABLE_DOCKER_BRIDGE=true/' bootstrap.sh

The tracking issue for actual EKS support is at https://github.com/aws/containers-roadmap/issues/864, and this solution comes from a comment

like image 33
afirth Avatar answered Oct 17 '25 10:10

afirth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!