Home > database >  kubectl not working on my windows 10 machine
kubectl not working on my windows 10 machine

Time:12-21

When I try to run any kubectl command including kubectl version, I get a pop-up saying "This app can't run on your PC, To find a version for your PC, check with the software publisher" when this is closed, the terminal shows "access denied"

The weird thing is, when I run the "kubectl version" command in the directory where I have downloaded kubectl.exe, it works fine.

I have even added this path to my PATH variables.

CodePudding user response:

thank you for the answer, @rally

apparently, in my machine, it was an issue of administrative rights during installation. My workplace's IT added the permission and it worked for me.

Adding this answer here so that if anyone else comes across this problem they can try this solution as well.

CodePudding user response:

Not knowing what exactly you downloaded, i would suggest you to delete everying in the folder and follow the instructions for installing kubectl for Windows from here:

https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/

Note: downloading the .exe is not enough. You need a kubeconfig file "config", which contains the configuration to access your cluster.

kubectl looks for this file in a hidden folder under your user profile directory. c:\users<me>.kube.

Just to let you try, i would suggest you to activate Kubernetes in your Docker-Desktop installation. I guess you have this installed. If not install it from the Dockersite. https://www.docker.com/products/docker-desktop/

Activating Kubernetes inside Docker-desktop, will install also kubectl and save the config in the .kube folder.

After the installation finished, in a new terminal:

kubectl get node

You should see the 1 node in the kubernetes-docker-desktop cluster.

Now if you want to access another cluster, you need the kubeconfig-file for that cluster. If you have it, just rename the config in the .kube folder (to not loose it) and put the other config inside.

If the new config file is correct you should be able to access that cluster.

The config file can be structured to hold more than one cluster configuration and you can switch between them using a so called context.

Here you can get the information how to do that, according to your needs: https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/

Hope this can help you, starting with KUbernetes.

  • Related