How to set up Kubernetes with Minikube on Windows Home
Guide to setting up a local Kubernetes cluster on Windows Home to test applications easily.
Containerized applications offer many advantages over traditional deployments, from ease of management to scalability and isolation. Hence, combining containerized applications with a proper orchestration engine is the best way to manage modern applications in staging and production environments.
As Windows Developers, we need a proper Kubernetes environment to test our applications. Windows Home handles most computing needs; Windows Pro offers more networking options and is more suited to small and medium-sized businesses that need to manage multiple machines. If you’re a Windows Home user, you can still create the required environment to set up and use Kubernetes clusters.
This article focuses on setting up a local Kubernetes cluster that enables us to test our applications easily. To do this, we will cover
- Local Kubernetes options
- How to install minikube
- How to create a Kubernetes cluster using minikube
- How to create a multi-node Kubernetes cluster
- How to mount folders to Kubernetes clusters
Local Kubernetes Options
There are multiple options to create a local Kubernetes cluster on a Windows environment, such as:
- Minikube- This is the most widely used feature-packed tool to implement local Kubernetes clusters on Windows, Linux, or Mac environments.
- Docker Desktop- Docker Desktop for Windows is the simplest solution that comes bundled with the ability to spin up a local Kubernetes cluster.
- kind- This is a tool to create Kubernetes clusters using docker containers as nodes. The primary focus of this tool is to test Kubernetes, while it can also be used for other purposes such as application deployments, testing, etc.
However, I prefer Minikube over others as it is a standalone solution with a lot of features useful for managing a local Kubernetes cluster.
How to Install Minikube
Minikube depends on a container or a virtual machine manager to deploy a Kubernetes cluster. The virtual machine managers it supports are Docker, Hyper kit, Hyper-V, KVM, Parallels, Podman, VirtualBox, and VMWare. Most Windows 10 Pro will use Hyper-V since it is built in, but since we are using Windows 10 Home, we will need to install a third-party hypervisor. This walkthrough will use VirtualBox, but first, let’s install Minikube itself.
For installation, Minikube offers multiple options such as a simple executable, using the Windows Package Manager, or the Chocolatey Package Manager.
You can use any of the options mentioned above to install Minikube. I will be using the Windows Package Manager in this tutorial. Run the
winget install minikube command from powershell to install Minikube.
Even with Minikube, we need the Kubernetes-CLI (kubectl) installed locally to connect and communicate with the Kubernetes cluster. Kubernetes offers two methods to install kubectl.
- Download the kubectl binary and add it manually to the windows path
- Use a package manager like Chocolatey or Scoop to install the kubectl and get it added to the path automatically. (Currently, Winget does not support installing kubectl)
Chocolaty kubernetes-CLI installation command
Once the installation is completed, we can verify if it is successfully installed by checking the kubectl client version. For that, run the following command;
You should download and install VirtualBox if you don’t have it installed already. Click the link on the download page for Windows hosts under platform packages and follow the installation instructions of the setup wizard.
Create a Kubernetes Cluster using Minikube
After the installation, we can use the start command to spin up a single-node Kubernetes cluster. This will create a Kubernetes cluster with the default values. Minikube automatically detects and selects a driver that is installed on your system. You can configure your preferred driver using the --driver flag or set the default driver using
minikube config set driver <driver>. You can check the driver configuration options for your preferred driver. In this doc, we will use VirtualBox.
Starting Minikube with Custom Options
We need to specify custom options to match the Kubernetes cluster with the local Windows environment. The most commonly specified options are resource usage and network connectivity.
We explicitly provide the following options in the above startup string when creating the Kubernetes cluster.
--driver=virtualbox- Enforce VirtualBox as the driver
--cpus=2- Limit the CPU count
--memory=2000m- Limit the memory to 2GB
--disk-size=”20000mb”- Define a disk size of 30GB
This will create a single-node Kubernetes cluster with user-configured options. In addition, you can customize the Kubernetes cluster further using the startup options offered by minikube.
If we look at the Virtual Box manager, we can see that a single minikube instance has been created.
Verify the Kubernetes Cluster configuration
We can simply run the kubectl to get the system pods of the Kubernetes cluster and thereby identify a successful configuration.
Create a Multi-Node Kubernetes Cluster
We can use the --nodes option to create a multi-node cluster if we need to simulate a multi-node Kubernetes installation. There, the only consideration is the availability of resources in the local machine.
The above command will create a Kubernetes cluster with three nodes.
We can see that three separate minikube nodes are created in the VirtualBox manager.
With kubectl we can see the three nodes are present in the cluster:
kubectl get nodes
Mounting Folders to Kubernetes Cluster
Since we are using a hypervisor (Hyper-V), the Kubernetes nodes do not have access to the host machine. Therefore, Minikube provides users with the mount option to map a host directory to the Kubernetes cluster.
In the following example we are mounting the
C:/data directory to the Kubernetes cluster as
The above command will prompt users with a message from the Windows Firewall to allow access to Minikube through the firewall. Here, you have to allow access, or otherwise, the mount will fail. (Grant permissions according to the network configuration)
In the end, Minikube will notify a successful mount. However, this mount is not permanent, and the user needs to keep the PowerShell window open (process running) to maintain the mount.
Verifying Firewall Rules
We can identify the firewall rules created by running the following command through Powershell.
Verifying the Mounted Directory
To verify the mount, run
minikube ssh command on a PowerShell window. It will establish an ssh connection to minikube. Next, view the directory listing with the
A successful mount will show the files in the host machine within the minikube directory.
Tools like minikube can be used to simplify local Kubernetes configurations. Additionally, developers using Windows Home can utilize minikube with Windows-based tools and technologies like Winget, Chocolatey, and Virtual Box to natively support Kubernetes and have optimal performance. It also eliminates configuration issues that may arise with third-party tools.
We can easily tailor the Kubernetes deployment using custom configurations to meet our exact needs. This ease of use enables us to easily create, test, and deploy containerized applications in Kubernetes.
- Join us on Slack
- Opt-in to receive email updates
If you'd prefer to learn independently and on your own time, you can also check out our local development environments learning journey. This Kubernetes learning journey walks you through the primary concepts and hands-on activities required to create an effective local development environment with Kubernetes, which includes everything from the containerization of code to real-time local testing of distributed services.