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

Minikube Tunnel --bind-address fails on windows/hyperv #19460

Open
rlyshw opened this issue Aug 16, 2024 · 6 comments
Open

Minikube Tunnel --bind-address fails on windows/hyperv #19460

rlyshw opened this issue Aug 16, 2024 · 6 comments
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@rlyshw
Copy link

rlyshw commented Aug 16, 2024

What Happened?

I am running on windows11, hyperv as the driver. I start the minikube with
minikube start --hyperv-virtual-switch bridge

I then attempt to expose a tunnel to the load-balancer with minikube tunnel --bind-address='*'

The tunnel fails to start with no indication as to exactly why. I have not been able to find any reference on how to solve the DRV_PORT_FORWARD error.

It seems like something is trying to exec hyperv but I can't tell if it's referenced internally (in the minikube vm) or external (my ps session). I'm not sure windows ships a ps utility just called hyperv, nor can I find reference to any linux cli utility named 'hyperv'. What am I doing wrong?

I'm posting here primarily because of the warning text, which does not actually include any "above advice". Maybe it should for this error?

PS> minikube tunnel --bind-address='*'
E0816 10:41:45.840236   33336 out.go:448] unable to execute error getting ssh port: get port 22 for "minikube": hyperv container inspect -f "'{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}'" minikube: exec: "hyperv": executable file not found in %PATH%
stdout:

stderr:
: template: error getting ssh port: get port 22 for "minikube": hyperv container inspect -f "'{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}'" minikube: exec: "hyperv": executable file not found in %!P(string=index)ATH&{%!
(string=index of untyped nil)}stdout:

stderr:
:1:92: executing "error getting ssh port: get port 22 for \"minikube\": hyperv container inspect -f \"'{{(index (index .NetworkSettings.Ports \"22/tcp\") 0).HostPort}}'\" minikube: exec: \"hyperv\": executable file not found in %PATH%\nstdout:\n\nstderr:\n" at <index .NetworkSettings.Ports "22/tcp">: error calling %!s(MISSING): %!w(MISSING) - returning raw string.

❌  Exiting due to DRV_PORT_FORWARD: error getting ssh port: get port 22 for "minikube": hyperv container inspect -f "'{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}'" minikube: exec: "hyperv": executable file not found in %PATH%
stdout:

stderr:


╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                 │
│    😿  If the above advice does not help, please let us know:                                                   │
│    👉  https://github.com/kubernetes/minikube/issues/new/choose                                                 │
│                                                                                                                 │
│    Please run `minikube logs --file=logs.txt` and attach logs.txt to the GitHub issue.                          │
│    Please also attach the following file to the GitHub issue:                                                   │
│    - C:\Users\RLYSHW~1.TOA\AppData\Local\Temp\minikube_tunnel_7b52c6b9692bdef292d16c62911b4f7fdc0c9c58_1.log    │
│                                                                                                                 │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Attach the log file

logs.txt

minikube_tunnel_7b52c6b9692bdef292d16c62911b4f7fdc0c9c58_1.log

Operating System

Windows

Driver

Hyper-V

@Bill-XU
Copy link

Bill-XU commented Nov 8, 2024

Got the same error.

It seems that minikube tried to execute this command:

hyperv container inspect -f "'{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}'"

but failed with:

exec: "hyperv": executable file not found in %PATH%

I have searched a lot of times about this "hyperv executable", but got nothing.
Microsoft Windows uses virtual manager and related DLLs to mange Hyper-V VMs.

Expect developers give helps on this case......

Bill

@Bill-XU
Copy link

Bill-XU commented Nov 8, 2024

Hello @spowelljr
Sorry for bothering... don't know who is in charge of this.

This issue may be caused by inappropriate calling of OCIBinary.inspect, in which the name of OCIBinary, which is "hyperv" in this issue, is used as executable to perform inspection on a container.
I located the code here in minikube/pkg/drivers/kic/oci/oci.go .

Would you please help check it or advise the right way of managing minikube using hyper-v?

Best regards,
Bill

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/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 Feb 6, 2025
@danmaninc
Copy link

Struggling with the same issue. Reproduced on minikube tunnel --bind-address='*' command.

This error also arises when using minikube service --all command (seems like it also calls inspect here and causes the same error)
Still cannot find any references on possible solution and the hyperv executable.

Hope someone can point me (and maybe other folks) in the right direction.

Image

@danmaninc
Copy link

Unfortunately, I did not find any solution for running minikube on Hyper-V correctly.

So, I decided to use just the Docker driver, and everything runs kinda smoothly. If you want to run it on Windows, this is a possible approach for you.
I just followed the default instructions, using WSL (i.e., not using PowerShell on the host machine):

  • Install kubectl on Linux (link)
  • Install minikube on Linux (link)
  • Start minikube: minikube start --driver=docker

minikube may fail to start first time, just try to delete it (minikube delete) and try to start it again.
Apparently, it works. For me, it worked from the third re-run.

Note: you should run your preferred Linux distro in WSL (not docker-desktop)

Image
Image

However, the problem with Hyper-V still persists and is not resolved.

@danmaninc
Copy link

Seems like it's trying to inspect the container like it is running in Docker (hyperv container inspect -f ... which is similar to the docker container inspect -f ...), but it looks like it is not applicable to Hyper-V. :(

Similar errors occur if you run it on Ubuntu without any driver installed. Therefore, I guess, the code is due to unknown reasons, just trying to inspect the Docker container (as mentioned here), where it is absent (or not applicable) because we are using the Hyper-V driver.

For now, I believe, if we remove such command execution (or replace it to relevant one) when running on Hyper-V, the error would disappear.

Please correct me if I'm saying something wrong.
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

5 participants