Logo

How to Run Kubernetes on Windows

Try this guide with our instant dedicated server for as low as 40 Euros

Kubernetes on Windows

Kubernetes is an open-source container orchestration platform designed to automate the deployment, scaling, and management of containerized applications.

Running Kubernetes production clusters on cloud platforms like Google Kubernetes Engine is common but costly. These expenses can hinder businesses and individuals who want to learn Kubernetes without a significant financial investment.

Fortunately, running Kubernetes clusters locally is a practical and cost-effective alternative. This allows for efficient application testing without impacting production environments or incurring cloud service costs.

While local setups may not perfectly replicate production environments, they offer an excellent starting point for learning Kubernetes concepts, developing applications, and gaining hands-on experience before moving to cloud-based clusters.

In this tutorial, we will discuss how to install and uninstall Kubernetes on Windows. However, before that, let us take a quick look at the prerequisites.

Table of Contents

  1. The Prerequisites to Installing Kubernetes on Windows
  2. How to Install Kubernetes on Windows
    1. Step #1: Enable Hyper-V
    2. Step #2: Install Docker for the Windows System
    3. Step #3: Install kubectl (Kubernetes CLI)
    4. Step #4: Install the Kubernetes
  3. How to Uninstall Kubernetes on Windows
    1. Remove Using Docker Settings
    2. Use Minikube
    3. Use Kind
  4. Conclusion
  5. FAQs

The Prerequisites to Installing Kubernetes on Windows

Before diving into the installation, ensure you have the following:

  • A system running Windows 10 or 11
  • A user account with sudo or administrative privileges
  • Terminal or command line access

How to Install Kubernetes on Windows

Before we begin, you should know that you cannot install Kubernetes on Windows like a typical Windows application. The process requires a virtual machine environment on Windows because Kubernetes is designed primarily for Linux environments.

Follow the steps below to set up a virtual environment for Kubernetes.

Step #1: Enable Hyper-V

Hyper-V, Microsoft’s hardware virtualization tool, allows the development of virtual machines (VMs) in isolated environments. It manages VMs via a command line interface or standard GUI.

Note: Hyper-V requires Windows 10 (Enterprise, Pro, or Education) with at least 4GB of RAM and CPU virtualization capability. If Hyper-V isn’t available, make sure that virtualization is enabled in your BIOS settings.

To activate Hyper-V on Windows, follow the steps below:

Open the Start menu and search for Turn Windows features on or off.

Click on the first result to open the Windows Features window.

Step #1 Enable Hyper-V

In the feature list, check the boxes next to Windows Hypervisor Platform and Hyper-V.

heck the boxes next to Windows Hypervisor Platform and Hyper-V

Click OK and wait for the installation to complete

Click OK and wait for the installation to complete.

Restart your system when prompted (select Restart Now).

Restart your system when prompted (select Restart Now)

Once the system restarts Hyper-V is activated on the system.

To verify the installation, open PowerShell as administrator and execute the following command.

> Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V

> Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V

If the Hyper-V is installed successfully, you will see Enabled in the state column.

Step #2: Install Docker for the Windows System

Kubernetes and Docker work well together. Docker is the foundation upon which Kubernetes is built, automating processes like resource access, configuration, deployment, and container generation.

To install Docker on Windows, start by visiting the Docker website and download the Docker Desktop for Windows.

Step #2: Install Docker for the Windows System

Next, run the downloaded installer to open the Docker installation wizard.

During installation, choose the Hyper-V backend (if WSL 2 is installed, keep both options checked).

Click OK to proceed.

Click OK to proceed

Once the installation is complete, click the Close and Restart option.

click the Close and Restart option

You will be prompted with the Service Agreement.

Read the Docker Terms of Service and check the I accept the terms box.

Click Agree to complete the Docker installation.

Click Agree to complete the Docker installation.

Once you accept the terms, the Docker GUI tool will launch automatically.

Once you accept the terms, the Docker GUI tool will launch automatically.

Step #3: Install kubectl (Kubernetes CLI)

Before installing Kubernetes, you should install kubectl, the Kubernetes CLI tool you use to execute commands on Kubernetes clusters.

Visit the official kubectl download page and download the latest version of the binary.

Save the downloaded file to a location you can easily remember, such as C:\kubectl.

Next, configure your system environment variables to include the path to the downloaded kubectl binary. For this, search for Environment Variables and click Edit the system environment variables.

Step #3: Install kubectl (Kubernetes CLI)

In the System Properties window, select the Advanced section and click Environment Variables.

click Environment Variables.

Under System variables, find the Path variable and click Edit.

find the Path variable and click Edit

Click New and enter the path to your kubectl binary file (e.g., C:\kubectl).

Click OK in all open windows to save the changes.

Click OK in all open windows to save the changes.

Next, open PowerShell and type kubectl to verify the installation. If the installation has been successful, you will see kubectl command help message.

 you will see kubectl command help message

Step #4: Install the Kubernetes

Docker includes a graphical user interface (GUI) tool that lets users install and enable Kubernetes and configure Docker settings. You can opt for several other methods such as Minikube, and Kind to install Kubernetes.

Choose the method that best suits your needs based on your system specifications.

  • Minikube: 2 CPUs, 2GB RAM minimum
  • Kind: 8GB RAM recommended
  • Docker settings: Up to 8GB RAM may be required

Method #1: Use the Docker GUI

Right-click the Docker icon in the system tray, and select Settings.

Method #1: Use the Docker GUI

Go to the Kubernetes tab and check the box next to Enable Kubernetes.

Next, click Apply & Restart.

Next, click Apply & Restart.

To continue, click Install when prompted. Docker will download and configure the required Kubernetes components in the background.

Once completed, both the Docker and Kubernetes icons will turn green in the system tray, indicating successful installation.

Once completed, both the Docker and Kubernetes icons will turn green

Method #2: Use Minikube

Minikube is an open-source program to administer Kubernetes. It works on Windows, Linux, and Mac by utilizing a virtual machine on the local system to run a single-node cluster.

You can opt for either of the following methods to install Minikube:

  • Use the winget
  • The Installer Wizard
Install with Winget

Open PowerShell and run the following command to install Minikube:

> winget install minikube

Install with Winget

Once the installation is complete, you will see the successful installation status message.

Use the Installer Wizard

Download the latest Minikube installer from the official website.

Click Next to continue.

Use the Installer Wizard

Next, you will be prompted to read the License Agreement. Click I Agree to continue.

Click I Agree to continue.

Next, choose the install location for Minikube or go with the default location and click Install.

with the default location and click Install

Once the installation is complete, click Next and exit.

click Next and exit

After installation, start the Minikube cluster by executing the following command in the PowerShell:

> minikube start

You will see Done once the installation is complete.

You will see Done once the installation is complete.

Method #3: Use Kind (Kubernetes in Docker)

Kind, or Kubernetes in Docker should be installed on your system as a prerequisite. Kind utilizes Docker containers to run Kubernetes instead of virtual machines. As a result, Kind starts up quicker than Minikube.

To install Kind, go to the official Kind Release page. Locate the Windows version download link in the Assets section.

Method #3: Use Kind (Kubernetes in Docker)

Rename the downloaded as kind.exe file.

Add the path of the downloaded file to the system environment variables and move it to a directory like C:\kind.

Next, add the kubectl environment variable path as mentioned in the Method #1.

Since we have added kubectl environment variable path, you can open PowerShell as administrator and run the following command to create a Kubernetes cluster using Kind.

> kind create cluster

> kind create cluster

As an alternative to the kubectl CLI tool, the Kubernetes Dashboard is the official web-based user interface (UI) to manage Kubernetes resources. It does not, however, deploy automatically and you need to manually set it up.

We recommend using the Dashboard to manage the cluster resources or deploy containerized apps to a Kubernetes cluster. You can build or edit Kubernetes resources and see an overview of the applications currently operating on the cluster.

To install the Kubernetes Dashboard, open PowerShell as administrator and run this command:

> kubectl apply -f

> kubectl apply -f

https://raw.githubusercontent.com/kubernetes/dashboard/v2.6.0/aio/deploy/recommended.yaml

Next, set up a secure channel for Dashboard access.

> kubectl proxy

> kubectl proxy

Access the Dashboard UI from

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

Access the Dashboard UI from

After you log in, the Dashboard displays an overview of the system.

After you log in, the Dashboard displays an overview of the system.

How to Uninstall Kubernetes on Windows

There are various ways to uninstall Kubernetes depending on how you installed it.

Remove Using Docker Settings

If you enabled Kubernetes in Docker settings, follow these steps:

Right-click the Docker icon in the system tray and select Settings.

Go to the Kubernetes tab and uncheck the box next to Enable Kubernetes.

Click Apply & Restart.

Docker will automatically remove the Kubernetes virtual machine.

Use Minikube

Stop and delete the Minikube virtual machine with these commands:

> minikube stop

> minikube delete

Next, delete the system’s .minikube and .kube directories.

id=’usekind”Use Kind

Delete any clusters created with Kind.

> kind delete cluster --name [name]

Replace [name] with the cluster name if you provided one during creation.

If you haven’t specified a name, run:

> kind delete cluster

Once you delete the cluster, delete the directory where you set up Kind.

Conclusion

Running Kubernetes on Windows can go efficiently if the right procedures are taken. Users can quickly build up a local Kubernetes cluster for development and testing by using programs like Minikube or Docker Desktop.

Follow the instructions provided to ensure a stable configuration and manage and deploy containerized apps on a Windows platform effectively.

FAQs

Q. What are the prerequisites for running Kubernetes on Windows?

To run Kubernetes on Windows, you need:

  • Windows 10 Pro, Enterprise, or Education (version 2004 or later)
  • Windows Docker Desktop with the Kubernetes option activated
  • Alternatively, Minikube with Hyper-V or VirtualBox

Q. How do I install Docker Desktop on Windows?

Visit the official Docker website and download Docker Desktop. Launch the installer and follow the instructions on the screen. Ensure you enable the Install required components for WSL 2 option during installation.

Q. How do I enable Kubernetes in Docker Desktop?

Open Docker Desktop and go to Settings. Select the Kubernetes tab and check the Enable Kubernetes option and click Apply & Restart.

Q. What is Minikube, and how do I install it?

Minikube is a tool that lets you run Kubernetes locally. To install it: Download Minikube from the official Minikube GitHub releases page. Launch the installer, or follow the manual’s installation guidelines. Ensure you have a hypervisor like Hyper-V or VirtualBox installed.

Q. How do I start a Kubernetes cluster with Minikube?

With administrator rights, open PowerShell or Command Prompt. Run the command: minikube start –driver=hyperv (or –driver=virtualbox if using VirtualBox). Follow any additional prompts to configure your hypervisor.

Q. Can I use Windows Subsystem for Linux (WSL) with Kubernetes?

Sure, you can have a better experience with WSL 2. Working with Kubernetes is made easier by Docker Desktop’s integration with WSL 2, which provides a more native Linux experience on Windows.

Q. How do I access the Kubernetes dashboard on Windows?

Ensure you have kubectl installed and configured. Run kubectl proxy to start the proxy server. Open your web browser and go to http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/.

Q. What are common issues when running Kubernetes on Windows and how do I troubleshoot them?

If Docker Desktop does not start, ensure your BIOS has enabled virtualization.

Unable to start Kubernetes: Verify whether any program using the same ports is causing issues.

Minikube start errors: Check that you have enough resources allocated and that your hypervisor settings are correct.

Q. How do I update my Kubernetes cluster on Windows?

For Docker Desktop, updates are managed through the Docker Desktop application. For Minikube you can update Minikube and restart your cluster with the latest version.

Q. Where can I find more resources and support for running Kubernetes on Windows?

You can find more information and support on the official Kubernetes documentation website, the Docker documentation website, community forums and Kubernetes Slack channels.

Try this guide with our instant dedicated server for as low as 40 Euros