This repository has been archived by the owner on Oct 10, 2023. It is now read-only.
Set node-ip in /etc/hosts instead of node-ip flag #4323
Merged
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.
What this PR does / why we need it
Setting the --node-ip on the kubelet can prevent the vsphere-cpi from configuring the node ip itself if its ip selection process detects a different IP for some reason. One occurance of this happening was the kubelet selecting the slaac address and the vsphere-cpi selecting the dhcpv6 address. This usually shouldn't occur because they both should normally select the first global ip on the nic, but timing may have caused kubelet to not select the dhcpv6 address.
When running with kube-vip, configuing the node ip in kubelet is desireable so that pods on the hostNetwork will not run on the kube-vip IP when the kubelet selects an IP for the node.
Kubelet can be informed of what IP to use by DNS lookup of the hostname instead of using --node-ip. This approach is advantageous because if the CPI were to choose a different IP, kubelet would not reject the IP. Setting a non floating kube-vip IP in the /etc/hosts file gives the desired DNS answer, allowing kubelet to launch pods on the host network, while also avoiding the kube-vip IP.
Which issue(s) this PR fixes
Fixes n/a
Describe testing done for PR
We deployed an ipv6 cluster with kube-vip and everything worked successfully.
We also forced kubelet to select an IP address that vsphere-cpi wouldn't select and see that vsphere-cpi is able to update the node addresses to a different ip successfully.
Release note
Additional information
Special notes for your reviewer