Cleanup EKS bootstrap parameters

2024年01月18日


According to AWS document, Amazon EKS adds Kubernetes labels to managed node group instances. These Amazon EKS provided labels are prefixed with eks.amazonaws.com.

EKS adds the following Kubernetes label to all nodes in your managed node group that specifies the capacity type: eks.amazonaws.com/capacityType: ON_DEMAND. You can use this label to schedule stateful or fault intolerant applications on On-Demand nodes.

EKS adds the following Kubernetes label to all spot nodes in the self-managed node group that specifies the capacity type: eks.amazonaws.com/capacityType: SPOT

Therefore, I do not need to manually label the worker nodes with the AMI ID it's using, or update that label every time I update the worker node's AMI or after I upgrade the EKS cluster.

/etc/eks/bootstrap.sh $name \
--kubelet-extra-args '--max-pods=110' \
--b64-cluster-ca $B64_CLUSTER_CA \
--apiserver-endpoint $API_SERVER_URL \
--dns-cluster-ip $K8S_CLUSTER_DNS_IP \
--use-max-pods false

For example, with the above script, a worker node will have the following labels with it. The labels that are prefixed with eks.amazonaws.com are added by EKS.

% k describe no ip-10-0-x-yy.us-west-2.compute.internal
Name:               ip-10-0-x-yy.us-west-2.compute.internal
Roles:              <none>
Labels:             beta.kubernetes.io/arch=arm64
                    beta.kubernetes.io/instance-type=t4g.medium
                    beta.kubernetes.io/os=linux
                    eks.amazonaws.com/capacityType=SPOT
                    eks.amazonaws.com/nodegroup=t4gmedium-spot
                    eks.amazonaws.com/nodegroup-image=ami-0f4914fefa7ca618d
                    eks.amazonaws.com/sourceLaunchTemplateId=lt-04xxx16
                    eks.amazonaws.com/sourceLaunchTemplateVersion=1
                    failure-domain.beta.kubernetes.io/region=us-west-2
                    failure-domain.beta.kubernetes.io/zone=us-west-2b
                    k8s.io/cloud-provider-aws=9366xxx756b
                    kubernetes.io/arch=arm64
                    kubernetes.io/hostname=ip-10-0-x-yy.us-west-2.compute.internal
                    kubernetes.io/os=linux
                    node.kubernetes.io/instance-type=t4g.medium
                    topology.ebs.csi.aws.com/zone=us-west-2b
                    topology.kubernetes.io/region=us-west-2
                    topology.kubernetes.io/zone=us-west-2b


References


Managed node groups

amazon-eks-ami/files /bootstrap.sh


Category: container Tags: public

Upvote


Downvote