Fix Kubernetes control-plane restart after IP rotation - #2158
Open
mxschmitt wants to merge 1 commit into
Open
Conversation
Author
Long-term design questionThis PR intentionally fixes the current single-node plugin with the smallest address-independent bootstrap change: new in-VM Kubernetes clients use I would welcome maintainer guidance on the longer-term abstraction before multi-control-plane support is added. At that point, loopback would no longer be sufficient and the plugin would need a stable shared endpoint, for example:
The legacy kube-proxy migration in this PR is deliberately only a compatibility path; it is not intended to become a general address-rewrite mechanism. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fix Kubernetes control-plane restarts when the container VM receives a new
IPv4 address.
Closes #2156.
What changes
/kind/kubeadm.confafter the initialkubeadm init.127.0.0.1:6443.state; kind already reconciles that state during its entrypoint.
Why this works
controlPlaneEndpointis the stable client endpoint in kubeadm. Theadvertise address is per-node state. kube-proxy persists its kubeconfig in a
ConfigMap, so putting the rotating VM address there made a restart depend on
the previous allocation.
The endpoint is deliberately loopback because the current plugin creates one
control-plane/worker node. A future multi-control-plane implementation should
use a real stable load balancer or virtual IP instead.
Restart flow
Validation
swift test --filter K8sBootstrapTests(3 tests passed)192.168.64.2 -> 192.168.64.3.verified
k8s startmigrated it to loopback.Service after restart.
The fix does not require sticky IP allocation, host DNS configuration, or an
additional proxy process.