This guide shows how to run Kubernetes in a Windows Host, using kind
to run the control plane in Docker and WSL 2 to run Docker itself.
The whole point of doing that is to run Kubernetes:
- In a Windows Host
- Without managing virtual machines (Docker Desktop + WSL 2 will do that for us)
- Without using Docker Desktop's native Kubernetes feature (as it has a tendency to break workflows that do not relly on K8s).
To use this guide, just follow each session sequentially. There are no optional steps.
scoop
is a lightweight package manager for Windows. It installs applications in ~/.scoop
and adds then to PATH
. We will use it to install CLI tools.
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
iwr -useb get.scoop.sh | iex
scoop --version
kind
is a tool for running local Kubernetes clusters using Docker containers as “nodes”.
kubectl
is a tool that allows runing commands against Kubernetes clusters.
We will install those tools using scoop
.
scoop install kind kubectl
kind version
kubectl version --client
Docker Desktop an application created by Docker Inc.'s (the company that created Docker, the technology). It provides a user friendly graphical user interface to run and inspect Docker containers. It also creates and manages a virtual machine in which containers are executed. That allows Windows users to run Linux containers. The most recent versions of Docker for Desktop run containers using WSL 2, which is a Windows subsystem that ships a Linux kernel, allowing users to run Linux distros in Windows without the overhead of a virtual machine.
To install Docker Desktop, download it from the official web page and follow the interactive graphical installer (this will require privillege elevation).
Create a cluster by invoking kind
, then check if kubectl
is configured correctly:
kind create cluster
kubectl cluster-info --context kind-kind
If everything was setup correctly, you should see a message like so:
Kubernetes control plane is running at https://127.0.0.1:62109
CoreDNS is running at https://127.0.0.1:62109/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
Create a simple deployment:
kubectl create deployment nginx --image=nginx --port=80
kubectl expose deployment/nginx
Resources can be accessed from the Windows host using a browser.
- Control Plane:
https://127.0.0.1:62109
- Services:
That's it. You can now run commands against your cluster using kubectl
or use graphical tools like Lens.