-
Notifications
You must be signed in to change notification settings - Fork 742
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
ipamd assigns IPs from detached ENIs #732
Comments
BTW, if you have suggestions for how to debug why our ENIs are getting detached in the first place, I'm all ears. We're using EKS in what we thought is a plain vanilla style. |
@tatatodd If you can find the time when the ENI was detached, it should be possible to search in CloudTrail for the |
Thanks @mogren! I looked in CloudTrail, and may have a lead. Here's the full events from CloudTrail for eni-02797faf7a67b1590 from the logs above. Based on timestamps, all of the stuff here happened before the stuff in the logs above (i.e. before the reboot). The user corresponding to these events is the EC2 instance itself.
Note that the final
Here's what the logs tell us: Here's the theory:
And here's what the logs post-reboot (in my first post) tell us:
But here's some open questions:
|
Answering my own question 1 from the previous post, given the retry loops around So I guess the core problem here is that an inopportune VM reboot that occurred right after an ENI was asked to be detached (but before it was really detached) caused the ENI to be assigned some pods, and thereafter I think my PR #733 fixes part of the problem, to ensure that at least once ENI reconciliation occurs, But there's still the problem that there doesn't seem to be a mechanism to fix existing pods that have already been assigned IPs from the detached ENI. I.e. we've been running v1.5.5 patched with #733 on our clusters, and we've seen this prometheus counter and warning in the logs: amazon-vpc-cni-k8s/ipamd/ipamd.go Line 361 in 067ddf2
Our only recourse so far is to identify the broken pods when this happens, and manually delete them. Any thoughts on when that will be fixed? |
@tatatodd Yes, great debugging on your part here, not sure when and how we will get this completely solved. To detach an ENI and return those IPs to the Subnet, the EC2 API requires you to first The on instance metadata service can be very out of date, 30 seconds is common, but we have seen up to 9 minutes on older instance types. What happens is that after a detach, the EC2 controlplane will say and know that the ENI is detached, but the instance metadata will still show it as Attached and it might get added back to the data store when ipamd restarts. |
@tatatodd Because of all the issues we have seen with the instance metadata being out of sync, I'm a bit wary about using it as the truth. Even if it's on the the instance, it's not always correct. That said, we should definitely not use IPs from a detached ENI. We will need to investigate this more. |
@mogren Gotcha, that's reasonable. Let me know if you'd like me to try anything out; we've been running into issues related to this on roughly a weekly basis in our clusters, so we're happy to help. :) |
I've been debugging an issue where ipamd assigns IPs from ENIs that are not attached to the EC2 instance. This is support case# 6601452261 (I dunno if you have access to that).
I've tracked it down to the ENI reconciliation logic. ipamd starts out with 3 ENIs, and assigns IPs from these ENIs, and all is good. Then one of the ENIs gets detached, outside of ipamd's control. Here's where badness starts; the datastore will continually refuse to remove the ENI, since some of its IPs are assigned. And ipamd will continue to assign IPs from this detached ENI, meaning that our pods end up with IPs that simply don't work.
In our specific case, we still don't know why the ENI gets detached; it seems to happen shortly after our VM reboots. We also don't know why our VM is rebooting. The working theory is that our EC2 instances end up with too many combined ENI+EBS attachments; i.e. more than the limit for our instance type. Perhaps that results in VM reboot, and subsequent ENI detachment.
Regardless of the reason, it seems clear that ipamd shouldn't continue to assign IPs from detached ENIs. I have a PR for a fix that I'll send shortly. Below are logs that demonstrate the problem from v1.5.5, that I've annotated whilst debugging.
The text was updated successfully, but these errors were encountered: