1 Answer
- Newest
- Most votes
- Most comments
1
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}
answered 5 years ago
Relevant content
- asked 2 years ago
- asked 2 years ago
- asked 6 months ago
- asked 4 months ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 4 months ago