kubernetes / minikube

Run Kubernetes locally
https://minikube.sigs.k8s.io/
Apache License 2.0
29.4k stars 4.88k forks source link

Wrong error message on minikube tunnel without Administrator privilege on Windows #9589

Open blueelvis opened 3 years ago

blueelvis commented 3 years ago

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"},
    },
priyawadhwa commented 3 years ago

Hey @blueelvis thanks for opening this issue, the error message could definitely be more helpful. If you, or anyone else, would be interested in fixing this I'd be happy to look at the PR

CKchen0726 commented 3 years ago

@blueelvis Hi, maybe we can add an advisement, such as log info in the following pic: image

CKchen0726 commented 3 years ago

/assign

fejta-bot commented 3 years ago

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-contributor-experience at kubernetes/community. /lifecycle stale

fejta-bot commented 3 years ago

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-contributor-experience at kubernetes/community. /lifecycle rotten

sharifelgamal commented 3 years ago

I believe this is still an issue. Help wanted!

sandeeppainuly commented 3 years ago

/assign