-
Notifications
You must be signed in to change notification settings - Fork 82
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
Fix: one NIC's IP pool shortage depleted IPs of other NICs in a multi-NIC setup. #4379
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…of other NICs in a multi-NIC setup. Signed-off-by: tao.yang <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4379 +/- ##
==========================================
+ Coverage 79.56% 79.85% +0.28%
==========================================
Files 54 54
Lines 6362 6369 +7
==========================================
+ Hits 5062 5086 +24
+ Misses 1103 1082 -21
- Partials 197 201 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
weizhoublue
approved these changes
Dec 11, 2024
cyclinder
reviewed
Dec 11, 2024
// Check if there is a duplicate Pod UID in IPPool.allocatedRecords. | ||
// If so, we skip this allocation and assume that this Pod has already obtained an IP address in the pool. | ||
if record.PodUID == string(pod.UID) { | ||
logger.Sugar().Warnf("The Pod %s/%s UID %s already exists in the assigned IP %s", pod.Namespace, pod.Name, ip, string(pod.UID)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉 info 级别就可以
This was referenced Dec 11, 2024
github-actions bot
pushed a commit
that referenced
this pull request
Dec 11, 2024
Fix: one NIC's IP pool shortage depleted IPs of other NICs in a multi-NIC setup. Signed-off-by: robot <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
cherrypick-release-v0.8
Cherry-pick the PR to branch release-v0.8.
cherrypick-release-v0.9
cherrypick-release-v1.0
Cherry-pick the PR to branch release-v1.0.
release/bug
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks for contributing!
Notice:
"release/none"
"release/bug"
"release/feature"
What issue(s) does this PR fix:
Fixes #4295
Special notes for your reviewer:
问题现象:
在 pod 使用 多 underlay 网卡时,若第一张网卡分配 IP 成功,第二张网卡因为ip不足而分配失败,会导致 pod 重启,而在重启后,第一张网卡会再次分配新的 ip .... 如此往复,会导致第一张网卡的 ip 池 ip 耗尽,同一个 Pod 的 UID 在池中被重复记录,导致该池资源被耗尽,无法为其他 Pod 提供地址分配。
原因:
在多网卡场景下,根据网卡依次调用 IPAM 为每张网卡进行地址分配。如 Pod 拥有网卡 eth0、net1。当 Pod 启动,先为 eth0 进行 IP 地址分配,然后为 net1 网卡进行地址分配。如果此时 net1 所使用的 IP 池地址资源不够,将分配 IP 地址失败,然后 IPAM 会进行循环重试分配,又会从 eth0 开始进行分配,故同一个 Pod 的 eth0 网卡会被 IP 池多次分配。直到 IP 池地址耗尽。
解决:
检查 IP 池中已分配的 IP 情况,如果对应的 UID 和当前需要分配的 Pod 的 UID 匹配,证明 Pod 的某张卡已经在该池中拿到了 IP 地址,无需继续分配,返回当前拥有的 IP 地址,以此避免重复分配导致 IP 地址被耗尽的问题。