Roddy of the Frozen Peas
Roddy of the Frozen Peas

Reputation: 15219

"Hyper-v commands have to be run as an Administrator" in minikube when running as Administrator

Windows 10 Enterprise. I'm trying to get minikube set up and am following the official documentation. When I try to confirm my installation, using the following command:

minikube start --driver=hyperv

Then I get this error:

X Exiting due to PR_HYPERV_AS_ADMIN: Failed to start host: creating host: create: precreate: Hyper-v commands have to be run as an Administrator
* Suggestion: Right-click the PowerShell icon and select Run as Administrator to open PowerShell in elevated mode.
* Documentation: https://rominirani.com/docker-machine-windows-10-hyper-v-troubleshooting-tips-367c1ea73c24
* Related issue: https://github.com/kubernetes/minikube/issues/4511

However, I am running Powershell as an Administrator. (Start menu > right click Powershell Icon > select "Run as Administrator".) I also tried running a regular cmd instance as Administrator -- same issue. Unfortunately the "Documentation" page in the message is a 404 and the "related issue" is closed with nothing useful.

How do I apply the appropriate Admin permissions to my Powershell or cmd instance to be able to use minikube with Hyper-V? This other question confirms that I do need to run as admin, but it appears that even running as admin isn't sufficient for whatever check minikube is doing under the covers.

(As a note, I was able to get it started using the docker driver, but I've done terrible things to my local docker and would prefer to use Hyper-V.)

Upvotes: 3

Views: 4572

Answers (1)

Aaron
Aaron

Reputation: 57798

For any future searchers, I ran into this same problem after an update to Windows 10. I was also running Powershell as an Administrator, and still saw this error.

> minikube start --memory 3072 --cpus=2
* minikube v1.23.2 on Microsoft Windows 10 Pro 10.0.19042 Build 19042
* Using the hyperv driver based on existing profile

X Exiting due to PROVIDER_HYPERV_NOT_RUNNING

Please try to add your user to the Hyper-V Administrators group

This ^ was the fix for me. Basically, I did the following:

  • Right-clicked on "This PC" and selected "Manage."
  • Found my user inside of "Local Users and Groups" -> "Users."
  • Opened my user's properties.
  • On the "Member Of" tab, I clicked "Add" and entered "hyper-v administrators."
  • "Check Names" ensured that I had it spelled correctly.

After that, my minikube start worked as expected.

Upvotes: 6

Related Questions