Kubernetes development environment using docker on Windows
Back in October 2017, Docker announced that they were bringing Kubernetes support to the Docker platform and that this option would be brought to the Community Editions.
Docker for Mac on the Edge channel has had support since 17.12; but now it is available on Windows with 18.02, released at the end of January 2018.
This release makes setting up a Kubernetes development environment on Windows much easier, compared to using minkube and the configuration required to use Hyper-V.
This post summarises how to get setup.
Install Docker for Windows — Edge channel
If you haven’t already got Docker installed, you can follow the installation instructions on the Docker documentation; just make sure you choose the Edge channel.
If you already have Docker installed but are on the Stable channel, you can switch to the Edge channel by going to Settings and then the General tab.
Just be aware of a few things when switching between channels.
Enabling Kubernetes
By default, Kubernetes support is disabled; to enable: go to Settings, select the Kubernetes tab and click the “Enable Kubernetes” checkbox.
More information can be found here.
Setting the context
After installation is complete, in order to use kubectl to communicate with the cluster, you will need to set the current context. To view the kubeconfig settings, run:
kubectl config view
The output of this command will look something like the following (by the way, I also have minikube setup):
Docker created a new context called docker-for-desktop. We need to use this one to communicate with docker’s Kubernetes cluster. My current context is minikube so to switch context, use the following command:
kubectl config use-context docker-for-desktop
Good to go
If the previous steps went without a hitch, you should now be all set up and if you run:
kubectl version
You can see the server version for docker’s Kubernetes cluster:
Have fun :)