Skip to content

fix: allow multiple minikube profiles to share the same network#22784

Open
mpobrien wants to merge 1 commit intokubernetes:masterfrom
mpobrien:allow-shared-network
Open

fix: allow multiple minikube profiles to share the same network#22784
mpobrien wants to merge 1 commit intokubernetes:masterfrom
mpobrien:allow-shared-network

Conversation

@mpobrien
Copy link
Copy Markdown

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 use

The 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.go to 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!

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mpobrien
Once this PR has been reviewed and has the lgtm label, please assign prezha for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested review from medyagh and prezha March 26, 2026 18:32
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Mar 26, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: mpobrien / name: Mike O'Brien (1fbac8d)

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Welcome @mpobrien!

It looks like this is your first PR to kubernetes/minikube 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/minikube has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 26, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Mar 26, 2026
@minikube-bot
Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Mar 26, 2026
@mpobrien mpobrien changed the title feat: allow multiple minikube profiles to share the same network fix: allow multiple minikube profiles to share the same network Mar 26, 2026
@nirs
Copy link
Copy Markdown
Contributor

nirs commented Apr 5, 2026

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple profiles cannot share docker network

4 participants