0

I am a regular user of Docker since a few years and I have the Docker service installed and running locally on my Win10Pro host. It works well. Now I want to get started with Kubernetes so I used the gcloud command-line installation to install Kubernetes and got the following message:

WARNING: There are older versions of Google Cloud Platform tools on your system PATH. Please remove the following to avoid accidentally invoking these old tools:

C:\Program Files\Docker\Docker\Resources\bin\kubectl.exe

Looks like my Docker installation brought in another version of kubectl which Google advises me to delete. Should I really just delete the file from my Docker installation?

There appears to be two versions of kubectl.exe installed now, one which came with Docker and one which I just installed from Google. Kubernetes in the Docker GUI is not enabled. Should I enable it in the Docker settings GUI?

enter image description here

After a while I tried to install Minikube and start it which results in the following output:

C:\WINDOWS\system32>minikube start
* minikube v1.5.2 on Microsoft Windows 10 Pro 10.0.17763 Build 17763
E1114 05:07:00.856628    3836 driver_windows.go:74] Can't find VirtualBox registry entries, is VirtualBox really installed properly? The system cannot find the file specified.
* Automatically selected the 'hyperv' driver
* Creating hyperv VM (CPUs=2, Memory=2000MB, Disk=20000MB) ...
* Preparing Kubernetes v1.16.2 on Docker '18.09.9' ...
* Pulling images ...
* Launching Kubernetes ...
* Waiting for: apiserver
* Done! kubectl is now configured to use "minikube"
! C:\Program Files\Docker\Docker\Resources\bin\kubectl.exe is version 1.14.7, and is incompatible with Kubernetes 1.16.2. You will need to update C:\Program Files\Docker\Docker\Resources\bin\kubectl.exe or use 'minikube kubectl' to connect with this cluster

C:\WINDOWS\system32>

But despite the above message, I can run and expose a service as expected:

C:\WINDOWS\system32>kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10
deployment.apps/hello-minikube created

C:\WINDOWS\system32>kubectl expose deployment hello-minikube --type=NodePort --port=8080
service/hello-minikube exposed

C:\WINDOWS\system32>kubectl get pod
NAME                              READY   STATUS    RESTARTS   AGE
hello-minikube-797f975945-tj4g6   1/1     Running   0          13s

C:\WINDOWS\system32>minikube service hello-minikube --url
http://172.17.100.11:30575

C:\WINDOWS\system32>

The service does show its output at the above url. Do you think that my installation and configuration of Kubernetes is alright or is there something that I need to fix? Did I do this correctly?

I did not remove the kubectl.exe from the Docker installation and I installed Minikube without being adviced to do it but it seems correct. What's peculiar is that the client and the server now show different versions:

C:\WINDOWS\system32>kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.7", GitCommit:"8fca2ec50a6133511b771a11559e24191b1aa2b4", GitTreeState:"clean", BuildDate:"2019-09-18T14:47:22Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.2", GitCommit:"c97fe5036ef3df2967d086711e6c0c405941e14b", GitTreeState:"clean", BuildDate:"2019-10-15T19:09:08Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}

C:\WINDOWS\system32>

2 Answers 2

1

You probably don't want to delete the file, just remove it from your path. You will need to look through your System and Account environment variables and look for PATH and remove C:\Program Files\Docker\Docker\Resources\bin\.

There is a good chance it that that will just work, I have both Docker Desktop and gcloud installed on this computer and I don't have the folder above in my PATH and both products work just fine without any warnings about old tools hanging about.

If you do continue to run into problems, for example with MiniKube, it can be helpful to use the Get-Command PowerShell command to figure out which executable is getting called:

Get-Command kubectl | Format-List

Will give you the full path to the executable that would be run if you issued the command kubectl:

Name            : kubectl.exe
CommandType     : Application
Definition      : C:\Program Files\Docker\Docker\Resources\bin\kubectl.exe
Extension       : .exe
Path            : C:\Program Files\Docker\Docker\Resources\bin\kubectl.exe
FileVersionInfo : File:             C:\Program Files\Docker\Docker\Resources\bin\kubectl.exe
                  InternalName:
                  OriginalFilename:
                  FileVersion:
                  FileDescription:
                  Product:
                  ProductVersion:
                  Debug:            False
                  Patched:          False
                  PreRelease:       False
                  PrivateBuild:     False
                  SpecialBuild:     False
                  Language:
0

The following are the instructions for setting up and installing Minikube and its dependencies for use on Windows Pro or Enterprise with Docker Desktop and HyperV.

Install Kubectl

  1. Create a new directory that you will move your kubectl binaries into. A good place would be C:\bin

  2. Download the latest kubectl executable from the link on the Kubernetes doc page:

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

  1. Move this downloaded .exe file into the bin directory you created.

  2. Use Windows search to type “env” then select “Edit the system environment variables”

  3. In the System Properties dialog box, click “Environment Variables”.

  4. In System Variables click on the “Path” Variable and then click “Edit”

  5. Click “New” and then type C:\bin

  6. Drag the newly created path so that it is higher in order than Docker's binaries. This is very important and will ensure that you will not have an out of date kubectl client.

  7. Click "OK"

  8. Restart your terminal and test by typing kubectl into it. You should get the basic commands and help menu printed back to your screen. If this doesn't work try restarting your machine.

  9. Run kubectl version to verify that you are using the newest version and not the out of date v1.10 version.

Install Minikube

  1. Download the Windows installer here:

https://github.com/kubernetes/minikube/releases/latest/download/minikube-installer.exe

  1. Double click the .exe file that was downloaded and run the installer. All default selections are appropriate.

  2. Open up your terminal and test the installation by typing minikube. You should get the basic commands and help menu printed back to your screen. If this doesn't work try restarting your machine.

Configure HyperV

  1. In Windows Search type "HyperV" and select "HyperV Manager"

  2. In the right sidebar click "Virtual Switch Manager"

  3. Leave selected "New Virtual network Switch" and "External" and click "Create Virtual Switch"

  4. Name the switch "Minikube Switch" (or whatever you would like to name it)

  5. Click Apply and acknowledge the "Pending changes" dialog box by clicking "yes"

  6. Once the switch has been created, click "Ok"

Starting Up Minikube

Since by default Minikube expects VirtualBox to be used, you need to tell it to use the hyperv driver instead, as well as the Virtual Switch created earlier.

Start up a terminal as an Administrator. Then, in your terminal run:

minikube start --vm-driver hyperv --hyperv-virtual-switch "Minikube Switch"

NOTE: all minikube commands must be run in the context of an elevated Administrator.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.