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:

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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠