kubernetes/minikube

Wrong error message on minikube tunnel without Administrator privilege on Windows

Open

#9,589 opened on Oct 30, 2020

View on GitHub
 (7 comments) (0 reactions) (2 assignees)Go (31,799 stars) (5,222 forks)batch import
good first issuehelp wantedkind/buglifecycle/frozenneeds-solution-messagepriority/backlog

Description

Steps to reproduce the issue:

  1. minikube start --driver hyperv
  2. Open a Command Prompt/PowerShell session without the Administrator privileges.
  3. minikube tunnel

Full output of failed command:

PS D:\dev\minikube> minikube tunnel --alsologtostderr
W1031 01:48:47.640326   45344 root.go:252] Error reading config file at C:\Users\Pranav.Jituri\.minikube\config\config.json: open C:\Users\Pranav.Jituri\.minikube\config\config.json: The system cannot find the file specified.
I1031 01:48:47.650327   45344 mustload.go:66] Loading cluster: minikube
I1031 01:48:47.654882   45344 main.go:115] libmachine: [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Hyper-V\Get-VM minikube ).state
I1031 01:48:48.560370   45344 main.go:115] libmachine: [stdout =====>] :
E1031 01:48:48.560370   45344 main.go:111] libmachine: [stderr =====>] : Hyper-V\Get-VM : You do not have the required permission to complete this task. Contact the administrator of the authorization policy for the computer 'DESKTOP'.
At line:1 char:3
+ ( Hyper-V\Get-VM minikube ).state
+   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : Unspecified,Microsoft.HyperV.PowerShell.Commands.GetVM


I1031 01:48:48.571373   45344 out.go:109] * The control plane node "" does not exist.
* The control plane node "" does not exist.
I1031 01:48:48.583371   45344 out.go:109]   - To fix this, run: "minikube start"
  - To fix this, run: "minikube start"

Instead of saying that the control plane doesn't exist, this should be throwing the following kind of error -

{
		Kind: Kind{
			ID:       "PR_HYPERV_AS_ADMIN",
			ExitCode: ExProviderPermission,
			Advice:   "Right-click the PowerShell icon and select Run as Administrator to open PowerShell in elevated mode.",
			URL:      "https://rominirani.com/docker-machine-windows-10-hyper-v-troubleshooting-tips-367c1ea73c24",
			Issues:   []int{4511},
		},
		Regexp: re(`Hyper-v commands have to be run as an Administrator`),
		GOOS:   []string{"windows"},
	},

Contributor guide