Cloud Native 9 min read

How to Quickly Set Up a Local Kubernetes Cluster on Windows with Rancher Desktop

Learn how to install Rancher Desktop on Windows, use WSL and PowerShell to create a one‑node Kubernetes cluster, deploy an Nginx app, and manage it via the Kubernetes Dashboard, offering a simpler alternative to Minikube for local development.

macrozheng
macrozheng
macrozheng
How to Quickly Set Up a Local Kubernetes Cluster on Windows with Rancher Desktop
If you have used Kubernetes before, you probably know Minikube; Rancher Desktop provides a more convenient graphical way to spin up a single‑node Kubernetes environment on Windows.

Rancher Desktop Overview

Rancher Desktop is an open‑source desktop tool for managing Kubernetes and containers. It has over 2.9K stars on GitHub and runs on Windows, macOS, and Linux. On Windows it installs the Kubernetes cluster automatically, avoiding the need to set up a VM for Minikube.

The interface allows one‑click switching of Kubernetes versions.

WSL

Thanks to Windows Subsystem for Linux (WSL), Linux can run on Windows without a traditional VM. Rancher Desktop leverages WSL to install the Kubernetes environment.

<code># Install the default Linux distribution (Ubuntu)
wsl --install
# List installed distributions
wsl --list --verbose
# List available distributions online
wsl --list --online
# Shut down the Linux subsystem
wsl --shutdown</code>

PowerShell

PowerShell is a cross‑platform automation and scripting shell that runs on Windows, Linux, and macOS. After the Kubernetes environment is ready, you can use PowerShell with tools such as Tabby to run kubectl commands.

Installation

We will install Rancher Desktop on Windows 10 and compare it with Minikube.

Download the Rancher Desktop installer from the official GitHub releases page.

Run the installer, choose the desired Kubernetes version and container runtime.

Rancher Desktop will automatically install the Kubernetes cluster and WSL. If the download fails, try switching the Kubernetes version (e.g.,

v1.21.9

).

After installation, you can use

kubectl

in PowerShell to interact with the cluster, e.g., view cluster info.

Usage

Deploy a simple Nginx application to verify that Rancher Desktop’s Kubernetes works like Minikube.

Create a Deployment for Nginx:

<code>kubectl create deployment kubernetes-nginx --image=nginx:1.10</code>

Check that the deployment is ready:

<code>kubectl get deployments</code>

Expose the Deployment via a NodePort Service:

<code>kubectl expose deployment/kubernetes-nginx --type="NodePort" --port 80</code>

Retrieve the Service to get the external port:

<code>kubectl get services</code>

Open a browser and access the Nginx service using the obtained port.

Visualization Management

Use the Kubernetes Dashboard to visually manage the cluster, just like with Minikube.

Install the Dashboard:

<code>kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.5.0/aio/deploy/recommended.yaml</code>

Create an admin user and bind the cluster‑admin role (dashboard‑adminuser.yaml):

<code>apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kubernetes-dashboard
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: admin-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin-user
  namespace: kubernetes-dashboard</code>

Apply the user configuration:

<code>kubectl apply -f dashboard-adminuser.yaml</code>

Generate a login token:

<code>kubectl -n kubernetes-dashboard get secret $(kubectl -n kubernetes-dashboard get sa admin-user -o jsonpath="{.secrets[0].name}") -o go-template="{{.data.token | base64decode}}"</code>

Start the proxy to access the Dashboard:

<code>kubectl proxy</code>

Then open

http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

in a browser.

Use the Dashboard to view Deployments, Pods, and Services.

Conclusion

Installing a Kubernetes environment on Windows has traditionally been cumbersome, but Rancher Desktop makes it straightforward. The experience is comparable to Minikube, and Windows users can now easily experiment with Kubernetes.

References

Rancher Desktop documentation: https://docs.rancherdesktop.io/

Kubernetes official documentation: https://kubernetes.io/zh/docs/home/

WSL documentation: https://docs.microsoft.com/zh-cn/windows/wsl/

KubernetesDashboardwindowsWSLkubectlRancher Desktop
macrozheng
Written by

macrozheng

Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.