Amazon Elastic Kubernetes Service (EKS) maximum pod calculation with secondary VPC CIDR

0

Amazon EKS includes scripts in the bootstrap.sh file to pass in the maximum number of pods per instance type based on the number of Interfaces and IPs per interface, and this works well for single CIDR VPCs.

However, it seems that when using a secondary CIDR range, the instance ends up with 1 less ENI available per node, and this can impact pod scheduling.

Does anyone have a solution to this?

References:

AWS
Shawn_O
已提问 4 年前952 查看次数
1 回答
0
已接受的回答

Here is a solution that can be implemented placed into the worker node userdata to dynamically calculate the number of pods.

# get instance details to feed into bootstrap script`
az=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone)
instance_type=$(curl -s http://169.254.169.254/latest/meta-data/instance-type)
    
# set region for aws cli
aws configure set region `curl -s http://169.254.169.254/latest/dynamic/instance-identity/document | jq -r .region`
    
# calculate number of max-pods
# https://docs.aws.amazon.com/eks/latest/userguide/cni-custom-network.html
max_if=$(aws ec2 describe-instance-types  --instance-types $${instance_type} --query  InstanceTypes[*].NetworkInfo.MaximumNetworkInterfaces --output text)
max_ips_per_if=$(aws ec2 describe-instance-types  --instance-types $${instance_type} --query  InstanceTypes[*].NetworkInfo.Ipv4AddressesPerInterface --output text)
max_pods=$((($${max_if} -1) * ($${max_ips_per_if} -1 ) + 2))
    
/etc/eks/bootstrap.sh  --use-max-pods false --kubelet-extra-args "--node-labels=k8s.amazonaws.com/eniConfig=$${az} --max-pods=$${max_pods}" '${cluster_name}
AWS
Shawn_O
已回答 4 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则