Skip to content
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

hyperv: minikube IP is not stable #4029

Closed
lluck42 opened this issue Apr 1, 2019 · 14 comments
Closed

hyperv: minikube IP is not stable #4029

lluck42 opened this issue Apr 1, 2019 · 14 comments
Labels
area/networking networking issues co/hyperv HyperV related issues help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. os/windows priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@lluck42
Copy link

lluck42 commented Apr 1, 2019

minikube 0.35.0

IP is always lose in hyperv VM on window 10.
If I shutdown hyperv , ip in minikube-hyperv is lost , and it will get a new ip.
but, this ip is refused by kubectl.
and i have to reinstall minikube all the time.

in window10 1803, switch is inner type,and shared ip from local-switch.

eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:01:8a:09 brd ff:ff:ff:ff:ff:ff
inet 192.168.137.186/24 brd 192.168.137.255 scope global dynamic eth0
valid_lft 604742sec preferred_lft 604742sec

@ssargent
Copy link

ssargent commented Apr 1, 2019

This isn't a perfect solution, but what I did was to create a dhcp reservation. I'm using a linux vm to dole out IPs on my hyperv network, so I just added the mac address of the minikube VM to the config and set it to always get the same IP address. As long minikube's vm isn't deleted this just works. If the mac address changes though, then I need to intervene.

@tstromberg tstromberg changed the title IP is always lose in hyperv VM on window 10 hyperv: minikube IP is not stable Apr 4, 2019
@tstromberg tstromberg added area/networking networking issues co/hyperv HyperV related issues help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. os/windows priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. labels Apr 4, 2019
@tstromberg tstromberg added r/2019q2 Issue was last reviewed 2019q2 priority/backlog Higher priority than priority/awaiting-more-evidence. and removed priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. labels May 23, 2019
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 21, 2019
@tstromberg
Copy link
Contributor

The workaround for this is to use minikube start to start your cluster. It will fix kubectl.

@tstromberg tstromberg added kind/feature Categorizes issue or PR as related to a new feature. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. r/2019q2 Issue was last reviewed 2019q2 labels Sep 19, 2019
@brainfull
Copy link

brainfull commented Nov 6, 2019

I also got a lot of problems getting a working solution and tried to get a static address setup in minikube or even a DHCP server to assign a static address. Here is what I did on my side. I understand your setup is different and my solution may not fit your needs. My setup is Hyper-V on Windows 10 Pro. I hope it gives you some food for thought as a minimum.

  1. Use internal VM Switch. You can set it up easily with the following powershell. It will take care of creating the VM switch if it doesn't exist and establish ICS between your internet connection and the internal VM Switch.
    Set-ICS.ps1.txt
    Open Powershell and call the script. In the following example it creates a VM Switch named 'minikube':
    ./Set-ICS.ps1 -VMSwitch minikube Enabled

  2. Create your minikube VM. Open Powershell and call the following command. In the following example it creates a VM named 'minikube' using the VM switch named 'minikube':
    minikube start --vm-driver hyperv --hyperv-virtual-switch minikube

  3. From that point on, your VM 'minikube' is available internally in your computer under the hostname (VM Name).mshome.net, if you followed the previous instructions that is 'minikube.mshome.net'. It is ICS DHCP server that takes care of defining that hostname under C:\Windows\System32\drivers\etc\hosts.ics

  4. Expose a service on a predefined Nodeport. Here is an example of a yaml that expose the port 22 of a container on Nodeport 30022, if you followed the previous instructions that is 'minikube.mshome.net:30022'. In my case this is an Open-SSH listening on port 22 so it allows me to SSH in my container.
    dev-service-bekno-worker-debug.yaml.txt

  5. Then you can open the port on your laptop which has its own external IP address and own external hostname on your network. One way to do it in Powershell is the following:
    netsh interface portproxy add v4tov4 listenaddress=127.0.0.1 listenport=2222 connectaddress=minikube.mshome.net connectport=30022

  6. F**k yeah! In my case I can open SSH connection on port 2222 from another computer. That opens up an SSH connection to a container within minikube!!! You may have to change your firewall rules to allow incoming connection on port 2222. If the port 2222 or 30022 are not available because of other services running on it, the previous steps may fail, in which case you need to change the ports.

I hope it gets you to a working solution for your setup. Definitely there is a lack of support about minikube on Windows. But I am committed to use it since it allows for greater productivity overall.

Have a look at this issue if you wonder why I use an internal VM Switch #5072 .

@priyawadhwa
Copy link

Hey @lluck42 are you still seeing this issue?

If yes, could you please try upgrading to the latest version of minikube and let us know if you still see this?

@mab
Copy link

mab commented Dec 18, 2019

I still face the issue.

minikube version: v1.6.1
commit: 42a9df4
Windows 10 Version 1809

minikube start --kubernetes-version="v1.14.8" --vm-driver="hyperv" --memory=4096 --hyperv-virtual-switch="VirtualSwitch"
minikube ip  # 192.168.252.153
minikube stop
minikube delete
minikube start --kubernetes-version="v1.14.8" --vm-driver="hyperv" --memory=4096 --hyperv-virtual-switch="VirtualSwitch"
minikube ip # 192.168.252.135

The idea of @brainfull looks promissing but is a bit hacky. Minishift provides an option to assign a static ip. That would be a great feature in minikube, too.

@pedroyan
Copy link

I'm also experiencing such issues on minikube version v1.6.2

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 28, 2020
@priyawadhwa
Copy link

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 20, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 18, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 17, 2020
@priyawadhwa
Copy link

We looked into adding this feature and static IP on hyperv doesn't seem feasible right now -- I'm going to go ahead and close this issue, but if anyone has strong feelings about this feel free to reopen.

@nbon12
Copy link

nbon12 commented Apr 5, 2021

is this still unfeasible? @priyawadhwa
is there any workaround to assign a static IP on windows?

@jimmoores
Copy link

This leads to a chicken and egg problem for users behind a proxy where you can't include the IP in the NO_PROXY list passed in because it's not been allocated yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/networking networking issues co/hyperv HyperV related issues help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. os/windows priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

No branches or pull requests