vantage-sh / ec2instances.info

Amazon EC2 instance comparison site
https://ec2instances.info
MIT License
5.11k stars 578 forks source link

Maximum number of pods per instance type #691

Open waldner opened 1 year ago

waldner commented 1 year ago

Although it's a number that can be calculated from existing data, would it be possible to add the information from this document: https://github.com/awslabs/amazon-eks-ami/blob/master/files/eni-max-pods.txt ?

Thanks!

EverettBerry commented 1 year ago

Thanks for bringing this up. We've actually gone back and forth on what the right choice is here. https://github.com/vantage-sh/ec2instances.info/issues/553 This will be pretty easy to add.

sschamp commented 3 months ago

This has now moved to https://github.com/aws/amazon-vpc-cni-k8s/blob/master/misc/eni-max-pods.txt Any word on this?

You could try to calculate it, and the formula would be Max IPs - Max ENIs + 2 (You could also do Max ENIs * (IPs per ENI - 1) + 2, it equates to the same. See https://stackoverflow.com/questions/57970896/pod-limit-on-node-aws-eks) And that works for 99% of the Instances Types, but for some exotic Instance Types that does not work, eg:

image

So best is to just look up in the table at https://raw.githubusercontent.com/aws/amazon-vpc-cni-k8s/master/misc/eni-max-pods.txt

This would be of great help, as right I can find the ideal Instance Types for my k8s, and when I want to use them, I get errors because I can't place all my pods on them. (we have many pods that require little CPU and RAM, and for a Dev Cluster we only need 3 Nodes..)

There is also this script which is present on all managed nodes:

/etc/eks/max-pods-calculator.sh --help
usage: /etc/eks/max-pods-calculator.sh <instance(s)> [options]
Calculates maxPods value to be used when starting up the kubelet.
-h,--help print this help.
--instance-type Specify the instance type to calculate max pods value.
--instance-type-from-imds Use this flag if the instance type should be fetched from IMDS.
--cni-version Specify the version of the CNI (example - 1.7.5).
--cni-custom-networking-enabled Use this flag to indicate if CNI custom networking mode has been enabled.
--cni-prefix-delegation-enabled Use this flag to indicate if CNI prefix delegation has been enabled.
--cni-max-eni specify how many ENIs should be used for prefix delegation. Defaults to using all ENIs per instance.
--show-max-allowed Use this flag to show max number of Pods allowed to run in Worker Node. Otherwise the script will show the recommended value

and can be found at:

https://github.com/awslabs/amazon-eks-ami/blob/main/templates/al2/runtime/max-pods-calculator.sh https://raw.githubusercontent.com/awslabs/amazon-eks-ami/main/templates/al2/runtime/max-pods-calculator.sh

example:

# /etc/eks/max-pods-calculator.sh --instance-type r7a.large --cni-version 1.18.1-eksbuild.3 --cni-prefix-delegation-enabled --show-max-allowed
434