Skip to content

Instantly share code, notes, and snippets.

@andrewabest
Last active January 2, 2020 10:59
Show Gist options
  • Save andrewabest/e20c10fa991d9c1b1d3b1bfcab7a1180 to your computer and use it in GitHub Desktop.
Save andrewabest/e20c10fa991d9c1b1d3b1bfcab7a1180 to your computer and use it in GitHub Desktop.
Kubernetes on Windows - detangling the mess

Kubernetes on Windows

The tooling for K8s on Windows has come a long way over the last couple of years and is starting to stabilise. Minikube 'just works' and you no longer need to fight it (stopping the cluster works now, yay!).

However the tooling has also become so prolific it tends to end up in various places on your machine nested inside other tools. So lets straighten that out.

Kubectl

Windows ends up with a mess of kubectl versions kicking around - VS 2019 has its own, Docker for Windows has its own, Azure Dev Spaces has its own, you may have downloaded the MSI, you may have installed it via Chocolatey.

To keep a consistent tool experience along with all of my other dev tooling (where possible) I like to ensure I install via Chocolatey

choco install -y kubernetes-cli

The next trick to make sure that is the version I'm always using regardless of where my terminal is, I'll ensure C:\ProgramData\chocolatey\bin\kubectl.exe is promoted to the top of the list in my System Environmental Variables.

Minikube

Same goes for Minikube as Kubectl - various tools might have installed their own version of it, so use Chocolatey to ensure when we call minikube we are getting the version we installed, not some tool.

Starting a new Minikube cluster

minikube start --vm-driver hyperv --alsologtostderr

When you start your cluster Minikube will take care of configuring your kubectl context to work with Minikube too. Neat!

Clean slate

These tools move fast - if you've played with them before, clean up any existing Minikube VMs with minikube delete before starting a new one, as you'll likely find its default tooling no longer matches up with your local kubectl, or other version discrepancies.

Cluster Exploration

Your weapon of choice should be kubectl for navigating around the insides of your cluster, however sometimes it is nice to have a GUI to quickly get a lay of the land.

Previously enabling the Kubernetes dashboard involved some hacks, but now it can simply be enabled and accessed via minikube dashboard.

What this does is actually kick off a Deployment of a new set of Services within Minikube, under the kubernetes-dashboard namespace. You can jump in and explore it from the dashboard - it is a nice way to get to look around what pieces a fairly standard Deployment will create within your cluster - Pods, Replica Sets, Services, Ingress, Config Maps, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment