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

Support for predictable IP's across restarts #951

raeesbhatti opened this Issue Dec 28, 2016 · 42 comments


None yet

raeesbhatti commented Dec 28, 2016


Minikube version (use minikube version): v0.14.0


  • OS : macOS Sierra 1.12.1
  • VM Driver : xhyve
  • Docker version: 1.11.1
  • Install tools:
  • Others:

What happened:
Minikube changes IP address when recreated.

What you expected to happen:
Minikube should retain the IP address when deleted and created again.

How to reproduce it (as minimally and precisely as possible):

  • minikube start --vm-driver=xhyve
  • minikube ip (note the IP address)
  • minikube stop
  • minikube delete
  • minikube start --vm-driver=xhyve
  • minikube ip (IP address has changed)

Anything else do we need to know:
I have several things configured to Minikube's IP address and have to recreate it occasionally. They all have to be reconfigured each time. It would be convenient to have Minikube not change its IP address after deleting and recreating.


This comment has been minimized.


ankon commented Dec 28, 2016

This also happens with the kvm driver, but not with the virtualbox driver.

Would be great if one could force a fixed IP address when using minikube start, independent of the driver.


This comment has been minimized.


r2d4 commented Dec 28, 2016

There is an option with the xhyve driver to set a static IP. By setting a static UUID here [0], you can ensure that you get the same IP across deletes/starts. We had this feature enabled for awhile but disabled it again because there were some issues. The discussion of the issues starts with this comment and continues in this issue. [1]

I think that this is a great feature to have, we just need to figure out the networking issues.

[1] #708 (comment)


This comment has been minimized.


dongsupark commented Jan 26, 2017

Same here. I have been seeing the issue that the IP address of VM changes across restarts.
It happens only with --vm-driver=kvm, not with --vm-driver=virtualbox. I don't know about the xhyve driver.


This comment has been minimized.

georgecrawford commented Mar 27, 2017

I'm seeing this with the xhyve driver as well. Any updates on a fix?


This comment has been minimized.

tmirks commented Mar 27, 2017

@georgecrawford There's a workaround by manually (or programmatically) updating /var/db/dhcpd_leases. I believe you can just delete the contents (make a backup just in case).


This comment has been minimized.


ankon commented Apr 6, 2017

I've by now seen this also with the virtualbox driver: typically my VM is, but sometimes it ends up as .101 or similar. Removing the minikube VM in those cases seems to help.


This comment has been minimized.

gheibia commented Apr 15, 2017

Same issue here. I'm using KVM and I don't even delete the cluster. I simply stop and start it again. I even tried to change dnsmasq's configuration to limit the DHCP​'s address range. Didn't make a difference.


This comment has been minimized.

n-k commented May 17, 2017

Same issue with vmwarefusion driver on OSX.


This comment has been minimized.


jstangroome commented May 21, 2017

Also occurring for minikube v0.19.0 with Virtualbox 5.1.18 on Windows 10 x64 Build 14393.1198.

  1. minikube start
  2. minikube ip (note the IP address)
  3. minikube stop
  4. minikube delete
  5. minikube start
  6. minikube ip (IP address has changed)

Assigned IP address has so far incremented from to


This comment has been minimized.

andziak commented Jun 21, 2017

The IP address for Minikube changes on Max OS with xhyve driver. It would be great to use static IP address as we're developing apps in Pycharm remotely on Minikube pods. This way we have a full working copy of the whole environment on developer's machine. When IP changes, we need to reconfigure dozen projects in Pycharm which takes lots of time.


This comment has been minimized.

zainul-ma commented Jun 22, 2017

its, would be great to have feature set static ip in minikube, any temp solution for this ?


This comment has been minimized.

garethr commented Aug 10, 2017

I've also seen this with the Hyper-V driver. Stopping and starting appears to fix the issue until you connect to a new network.


This comment has been minimized.

squillace commented Aug 20, 2017

Yeah, this isn't a feature, as it makes dnsmasq harder to configure. Now you can't map domain names to a single IP. Looking for any workaround here.


This comment has been minimized.

dgoldssfo commented Aug 23, 2017

@squillace On Mac:

minikube start
minikube ip (for me, 192,168.99.100)
minikube stop; minikube delete
Stop/quiesce all running VMs
sudo /Library/Application\ Support/VirtualBox/LaunchDaemons/ restart
minikube start
minikube ip (192,168.99.100 like I want and not


This comment has been minimized.

yoshiwaan commented Aug 23, 2017

Having the DHCP addresses reset after a login/logout or some other trick isn't a good solution. What if I want to work on minishift for a while before I start up minikube? What if I have a test kitchen run running that uses VirtualBox?
You need a clear way to set a static address for minikube (and thus you can create a hosts entry for it as well). Something --ip-address

The solution that micheletedeschi posts (there's 2 comments from him) in docker/machine#1709 works pretty well for docker-machine. If minikube had a similar way to run arbitrary scripts at boot up then that would be one quick way to solve the problem in a way that doesn't remove the option for a command line flag in the future.


This comment has been minimized.

dgoldssfo commented Aug 23, 2017

I agree, it's a workaround/hack and it should only be used in situations where you don't have a bunch of other VMs that you need to worry about running on VirtualBox. I should have indicated that in my previous post, thanks for posting this.

And yes, minikube definitely needs to have a way to use a static IP.


This comment has been minimized.


gbraad commented Aug 24, 2017

Although I am now experimenting with adding an option --ip-address to minishift: minishift/minishift#1293 this is not easy for each hypervisor. The workarounds used allow the VM to get an IP address from the hypervisors DHCP server, and then change it in-place with the given option.

In my case, I am experimenting with Hyper-V as it allows to pass data to the VM, but so far I none of the other hypervisors do this. This means that the value can be passed into the VM before it has even tried to get an IP address (before the docker-machine provisioning started). Since it would several problems we have with Hyper-V: minishift/minishift#418 #1627 it is my focus for the moment.

If you have other suggestions, please let me know... especially when it concerns the other hypervisors.


This comment has been minimized.


gbraad commented Sep 1, 2017

Static IP address option for Minishift using HyperV is being worked on as minishift/minishift#1316. I am coordinating with @aaron-prindle to see if this can also work for minikube.


This comment has been minimized.


gbraad commented Sep 27, 2017

PR with a possible solution is available at Minishift's repo for testing. Instructions are here: minishift/minishift#1316 (comment)
If results are usable, we will also integrate this in minikube and the iso.


This comment has been minimized.

coryasilva commented Nov 7, 2017


This comment has been minimized.

JavaJung commented Jan 5, 2018

New user of minikube and kubernetes-cli here. I have this issue of changing minikube ip too, on mac. The driver is Hyperkit commit 3e3161, minikube v0.24.1, kubectl 1.8.0 (client and server).

If it will be possible to integrate setting a static ip for the VM in minikube, would that work for every driver?


This comment has been minimized.

pfk-beta commented Feb 19, 2018

Same issue, doesn't matter which vm driver used.


This comment has been minimized.

DennisBayer commented Feb 26, 2018

Hi @gbraad,
any news on this issue, e.g. an ETA?

Best regards!


This comment has been minimized.

styk-tv commented Mar 6, 2018

So --vm-driver=virtualbox has no effect on my Mac. Start-Stop-Start will still rotate. It seems they go from 100 to 103 and then repeat.

I was experimenting with export HOSTALIASES (you can have your userspace personal hosts file. Works on Ubuntu, HOWEVER not working on Mac) Would be nice to just map minikube.local and then output that local hosts file.

Well i still decided to go that path with sudo to update /etc/hosts. (after minikube start) Not ideal but it works. All provisioning scripts after that reference minikube.local hostname.

EDIT: use below at your own risk. test on a copy of hosts first before you set against your system file. Tested on Macbook. It detects the line with minikube and replaces entire line with new line and new ip - puts a tab in between. Yes it asks for root pass, yes its bad, yes it works.

sudo sed -i -e 's/.*minikube.*/'$(minikube ip)$'\tminikube.local/' /etc/hosts

This comment has been minimized.

adammwood commented Mar 6, 2018

Similar to @styk-tv's comment, we're working around this issue current (on MacOS) with the following script that we use to start Minikube. A few points about it:

  • We're using Dnsmasq to resolve *.minikube.test (our local development prefix for projects - you can change it at minikube_ingress_domain_root) to the Minikube IP on startup, so Homebrew and Dnsmasq is required to use this. You could alternatively put/replace entries in /etc/hosts, however this doesn't support wildcards, so Dnsmasq works better for us.
  • We dynamically allocate 50% of system resources to Minikube, which I've included in case it's useful to anyone, however it's irrelevant to this problem.
  • This script also works around the issue (#1926). Again, this is irrelevant to this problem.

echo "Removing file if present (";

if [ -f ~/.minikube/machines/minikube/ ]; then
    sudo rm ~/.minikube/machines/minikube/

echo "Configuring Minikube resource usage...";

machine_cpus="$(sysctl -n hw.ncpu)";
machine_memory="$(expr $(sysctl -n hw.memsize) / 1048576)"; # Bytes to megabytes conversion (x/2^20)
minikube_cpus="$(expr ${machine_cpus} / 2)";
minikube_memory="$(expr ${machine_memory} / 2)";

echo "Machine resources: ${machine_cpus} CPUs / ${machine_memory}MB Memory";
echo "Configure Minikube to use 50%: ${minikube_cpus} CPUs / ${minikube_memory}MB Memory";

echo "Running 'minikube start --vm-driver=hyperkit --cpus ${minikube_cpus} --memory ${minikube_memory}'..."

minikube start --vm-driver=hyperkit --cpus ${minikube_cpus} --memory ${minikube_memory};
minikube addons enable ingress;

echo "Minikube started. Status:";
minikube status;

echo "Configuring Dnsmasq...";

cat <<EOL > /usr/local/etc/dnsmasq.conf
address=/${minikube_ingress_domain_root}/$(minikube ip)

sudo mkdir -p /etc/resolver/

echo "nameserver" > ${tmp_file}
sudo mv ${tmp_file} /etc/resolver/${minikube_ingress_domain_root}

sudo brew services restart dnsmasq

echo "Dnsmasq configured. All local requests to *.${minikube_ingress_domain_root} will resolve to Minikube.";

This comment has been minimized.

mans0954 commented Mar 20, 2018

On Debian I'm doing this:

  1. Find the VM MAC address:
sudo virsh net-dhcp-leases default
 Expiry Time          MAC address        Protocol  IP address                Hostname        Client ID or DUID
 2018-03-20 22:31:12  68:c2:7d:7b:be:42  ipv4        minikube        ff:5c:bb:eb:5e:00:02:00:00:ab:11:c0:9e:7d:2d:18:6f:69:18
  1. Stop minikube
minikube stop
  1. Edit the minikube-net to make a static reservation. I've chosen to fix as the IP address for minikube
sudo virsh net-edit minikube-net
  <bridge name='virbr1' stp='on' delay='0'/>
  <mac address='52:54:00:3f:a7:fa'/>
  <ip address='' netmask=''>
      <range start='' end=''/>
      <host mac='68:c2:7d:7b:be:42' name='minikube' ip=''/>
  1. Recreate the minikube-net network
sudo virsh net-destroy minikube-net
sudo virsh net-start minikube-net
  1. Check that the static lease has been created
cat /var/lib/libvirt/dnsmasq/minikube-net.hostsfile
  1. Restart minikube
minikube start
  1. Check that the static lease is working
minikube ip

I imagine that this could be scripted somehow. I'm presuming that the MAC address of the VM is fairly static?

I don't know if Mac OS X uses libvirt, but if not presumably there is an equivalent library?

Does that help?



This comment has been minimized.

mans0954 commented Mar 20, 2018

As an aside, installing Libvirt's NSS module allows minikube to be accessed as minikube rather than by IP address. I don't think that helps on OS X though, and it's not useful for setting ufw firewall rules (e.g. for mounting host folders) or mapping other hostnames to minikube.


This comment has been minimized.

pangehrn commented Apr 17, 2018

On Windows 10 and VirtualBox the following steps worked for me to set the IP back to the initial value:

  • minikube stop
  • edit config file: %USERPROFILE%\.minikube\machines\minikube\config.json
    • change value of "IPAddress" back to the initial one (for me it was
  • minikube start
  • minikube ip (shows
  • minkube dashboard (the dashboard opens on IP

This comment has been minimized.

lcannon commented May 30, 2018

I've been trying to develop a script to set up local development environments for our team recently, and have run into an issue here. Given that we may also want to be running multiple profiles at the same time, and the inability to select a static IP, I thought the easiest way to handle things would be to assign a given profile a given mac address, then use dnsmasq to tie that mac address to a given IP.

Unfortunately, the virtualbox DHCP server interferes with the dnsmasq assigned addresses. I can turn off and disable the virtualbox DHCP, but it seems that it gets re-enabled the next time minikube start is run -- is there a way to work around this?


This comment has been minimized.

jolson490 commented Jun 14, 2018

Note I tried the work-around described by @pangehrn on this comment above on my Mac (with Docker For Mac and minikube v0.28.0 and VirtualBox), but it didn't work for me - the minikube start command overwrote how I changed IPAddress to

I swear minikube ip used to always return for me, but lately every time I do a minikube delete & minikube start then the right-most digit increments by 1 each time - i.e.,, etc.


This comment has been minimized.

pietervogelaar commented Aug 21, 2018

Being able to configure a fixed IP would be very nice!


This comment has been minimized.

compugician commented Aug 21, 2018

+1 - It would indeed be very nice to have!


This comment has been minimized.

ianfoo commented Aug 24, 2018

Agreed, I'd love to be able to force an IP address. We use minikube as our local dev environment, and unfortunately many of the scripts assume an IP address of, which was, admittedly, short-sighted, and now a problem since my minikube comes up as, after having created and deleted a few additional minikube profiles/clusters.

I was optimistic, before finding this issue, that editing the ~/.minikube/*/config.json files would do the trick, but alas, it does not, for my macOS+VirtualBox based minikubes.


This comment has been minimized.


gbraad commented Aug 25, 2018


This comment has been minimized.

bfarayev commented Aug 28, 2018

@ianfoo I had the issue on my MacOS + VirtualBox and editing ~/.minikube/profiles/minikube/config.json "NodeIP": "", line to

        "NodeIP": "",

worked for me. Using minikube v0.28.2


This comment has been minimized.

ianfoo commented Sep 6, 2018

Thanks @bfarayev, though I tried that, along with setting the IP in the .minikube/machines/minikube/config.json, and it keeps coming back as I'm on minikube 0.25.2, though, since 0.28.x and 0.27.0 never get past Starting cluster components... (another--but separate--issue that I've been unable to resolve).

@tstromberg tstromberg changed the title from Minikube returns new IP address when recreated to Support for predictable IP's across restarts Sep 19, 2018


This comment has been minimized.

massenz commented Sep 30, 2018

Update: @bfarayev solution does not actually seem to work on Ubuntu/Virtualbox (Minikube 0.28.2).
Weird, as I tried it, and it seemed to work; but it no longer does.

The confusing part is that there are actually two config.json files: one in ~/.minikube/machines/minikube and the other in ~/.minikube/profiles/minikube: it's actually not clear whether these are generated (after the VM is started) or are used to drive the VM's configuration.

Be that as it may, changing the values for NodeIP and IPAddress does not seem to make any difference at all, they both are overwritten at startup with the new values (I found that the VBox vboxnet driver assigns DHCP addresses in sequence and never seems to "reset" the count, even if the machine that took the previous one was deleted).

The only workaround I could find, to have the minikube VM to always retain a "predictable IP" ( after a minikube delete, was to also delete the vboxnet- that was associated with the VM.

Obviously, a major 👍 to having something like --ip or similar as an argument for minikube start.


This comment has been minimized.

metamaker commented Oct 1, 2018

It would be interesting to hear what k8s developers think about this issue. People, do you have any plans to make this feature in near future?

Inability to have static IP kills my productivity in development environment, as I have to manually change IP address in my other tools (MySQL GUI, MongoDB GUI clients) periodically on Minikube restart.


This comment has been minimized.


tstromberg commented Oct 2, 2018

@metamaker - It's something I fully feel should be implemented and be on our development roadmap, and I am fully open to accepting any patches. This is a prerequisite for multi-VM minikube, should it be determined that we want to go that route.

The complication that makes this slightly more difficult to implement than one would expect is the matrix of supported platfoms (hypervisors and host operating systems). The rest shouldn't be so bad.


This comment has been minimized.

massenz commented Oct 2, 2018

The complication that makes this slightly more difficult to implement than one would expect is the matrix of supported platfoms (hypervisors and host operating systems).

That's an excellent point; maybe it could be simplified if, instead of allowing "pick an IP you like, any IP", the requirement were "we guarantee that the value returned by minikube ip will be consistent on your machine across delete and restarts" - but it may be different elsewhere, depending on the OS/hypervisor combination.

What I was originally trying to do was to have dev setup that required the same IP on Ubuntu and MacOS - but (a) that's probably a rather infrequent use case and (b) I was able to actually work around that.


This comment has been minimized.

massenz commented Oct 2, 2018

Also, I'd like to point out that the title of this issue is slightly misleading: as far as I can tell, any sequence of minikube stop/start will preserve the IP - it is the minikube delete that messes up things (this is also consistent with the original report).

At least as far as I could tell (again, across Ubunt/MacOS); would be curious to know if others have a different experience?

(still somewhat annoying - as one ends up deleting the minikube VM more often than one would like to - but not as bad)


This comment has been minimized.

rmorrise commented Oct 3, 2018

@massenz On win7, restarting my PC will sometimes cause the IP to change, even if minikube was not deleted and recreated.

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