fix: allow multiple minikube profiles to share the same network#22784
fix: allow multiple minikube profiles to share the same network#22784mpobrien wants to merge 1 commit intokubernetes:masterfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mpobrien The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
|
|
Welcome @mpobrien! |
|
Hi @mpobrien. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Can one of the admins verify this patch? |
|
@mpobrien creating multiple clusters on the same network works for vm drivers (kvm on Linux, vfkit and krunkit on macOS). Would be nice to make it work also in docker. |
fixes #14799.
This change makes it possible to start multiple minikube profiles and provide the same value for
--network.Previously, this would fail because both profiles would attempt to use the same IP in that network, and trigger this error:
❌ Exiting due to GUEST_PROVISION: Failed to start host: can't create with that IP, address already in useThe fix here is in
pkg/drivers/kic/oci/network_create.go(as suggested by @medyagh in the issue linked above): surface the ContainerIPs that docker network inspect already returns (they were parsed but discarded). Add AllocateFreeContainerIP, which inspects the live container IPs on a network and returns the first unoccupied address starting from gateway+1. This is analogous to how FreeSubnet works for network allocation.I also made a minor change to
pkg/drivers/kic/oci/network.goto handle containers attached to multiple networks. This could be useful if you wanted to attach a shared network to the two profiles after start time.My use case for this:
I'm working on an application that involves multiple kubernetes clusters, and some of the pods within each cluster will need to send traffic to a pod in another cluster. Modeling that setup with minikube (for testing) isn't possible right now because there's no way for a pod in cluster A to route its traffic to cluster B since they are on separate networks.
I welcome your thoughts!