Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for get subnets command to show number of /28 prefixes available/assigned #104

Open
veekaly opened this issue Sep 8, 2023 · 1 comment

Comments

@veekaly
Copy link

veekaly commented Sep 8, 2023

When using VPC Prefix delegation for already existing EKS cluster, we need to make sure that the VPC subnets are not fragmented so that the VPC CNI is able to efficiently utilize all of the /28 contiguous blocks of IPs from the subnets to assign IP addresses for pods. Having largely fragmented subnets will lead to many of the IP addresses (non contiguous) being under utilized in the subnet leading to IP exhaustion.

As of today, eksdemo get subnets command shows the amount of available IP addresses in the subnet. Having the information about number of contiguous blocks of IP addresses available in the subnets is going to help the EKS users in deciding if prefix-delegation is a viable option or not.

My proposal is to add a flag --show-prefix-count to the eksdemo get subnets command to show the amount of available/assigned /28 prefixes in the subnets.

Proposed Usage:

eksdemo get subnets --show-prefix-count

+--------------------------+------------+-----------------+----------+---------------+-----------+
|            Id            |    Zone    |    IPv4 CIDR    | Free IPs | Free Prefixes | IPv6 CIDR |
+--------------------------+------------+-----------------+----------+---------------+-----------+
| subnet-xxx               | us-east-1b | 10.1.128.0/18   |    16378 |          1023 | -         |
| subnet-yyy               | us-east-1b | 10.1.255.192/26 |       59 |             4 | -         |
| subnet-zzz               | us-east-1a | 10.1.255.128/26 |       58 |             3 | -         |
| subnet-aaa               | us-east-1a | 10.1.0.0/17     |    32762 |          2047 | -         |
+--------------------------+------------+-----------------+----------+---------------+-----------+

To do this, we can prepare the list of /28 prefixes based on CIDR range, get the IP addresses and prefixes (if any) already assigned in the subnet and remove them from the initial list, and the remaining would be available prefixes.

Note: This will also help in troubleshooting issues that might arise when the VPC CNI is unable to get a contiguous /28 Prefix for allocation (Client.InsufficientCidrBlocks) even when there are free IP addresses available in the subnets.

@veekaly
Copy link
Author

veekaly commented Sep 8, 2023

I can work on this feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant