-
Notifications
You must be signed in to change notification settings - Fork 756
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
Make Maximum Pods ENIConfig aware #331
Comments
Going to work on a PR to see if I can modify this behaviour next week. Will link here if I come up with a solution. |
Thanks @taylorb-syd, I'm trying to catch up a bit on the issues again. |
Okay, digging a little deeper, the maximum pod setting is actually set when |
Do you plan to handle pods with |
@cnelson Unfortunately there is no way to dynamically set the number of max pods in However, that being said, if you know ahead of time how many |
@taylorb-syd for never versions of EKS on 1.11+ this is doable I think: https://kubernetes.io/docs/tasks/administer-cluster/reconfigure-kubelet/ |
In the basic solution, it's simple. If we properly have access to a true export of this1 then we can do:
... in the bootstrap. Where I'd be happy for that as an initial break-fix, but seems not very good in the long run. @taylorb-syd curious if you did anything clever yet? Footnotes |
@frimik Happy for you to put attention into this, I have been swamped last month and couldn't put any energy/effort into this. |
In case of custom CNI Networking,
|
I use this script to generate import requests
import json
from bs4 import BeautifulSoup
response = requests.get("https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#AvailableIpPerENI")
parsed_html = BeautifulSoup(response.text, features="html.parser")
table = parsed_html.find('table', attrs={'id': 'w299aac23c19c19b5'})
rows = table.find_all("tr")
instance_max_pods = {}
for row in rows:
cells = row.find_all("td")
if len(cells) < 1:
continue
# (# of ENI - 1) * (Max IPs per ENI - 1) + 2
instance_max_pods[cells[0].text.strip()] = (int(cells[1].text) - 1) * (int(cells[2].text) - 1) + 2
# Add two for aws-node and kube-proxy hostNetwork pods
# IPs per ENI - 1 = One IP address is allocated to the Host ENI itself.
print(json.dumps(instance_max_pods)) |
Refer to the below discussion: - Maximum Pods ENIConfig aware awsdocs#331: aws/amazon-vpc-cni-k8s#331 - Containers stuck in ContainerCreating after configuring CNI Custom Networking on extended CIDR awsdocs#527: aws/amazon-vpc-cni-k8s#527
Related issues: #527 |
table ID is changed to |
New helper script is added for CNI v1.9.0 onwards - https://github.com/awslabs/amazon-eks-ami/blob/master/files/max-pods-calculator.sh to help compute the max pods. This takes into consideration CNI version, custom networking, max eni and prefix delegation is configured. Also with MNG this script will be triggered on AMI startup to configure kubelet maxPods. |
Summary
If you specify an
ENIConfig
which differs from the primary ENI configuration of the instance on startup, the plugin correctly does not allocate IP addresses on the primary ENI, however it the Maximum Number of Pods assignable to the worker node is still derived based upon the assumption that all secondary IP addresses can be consumed. This results in pods getting stuck inContainerCreating
status.We should dynamically adjust the maximum number of pods when using an
ENIConfig
to reflect the maximum number of IPs that can be consuming that align with the ENI Config.Reproduction Steps
ENIConfig
in a different subnet from the primary ENI.t2.medium
or similar instance (must have a healthy number of secondary IP addresses, whicht2.medium
has 3 x 6).nginx
) with a large number of pods (e.g. 200)Observe that while most pods stay in
Pending
one ENI's worth of pods will be stuck inContainerCreating
. In the case of at2.medium
, this is 5:Looking at these pods closely we can see they are stuck looping over the following state:
The text was updated successfully, but these errors were encountered: