Setting up minikube & VirtualBox on Windows 10

minikube is is a tool that allows you to setup and run a local Kubernetes cluster, for learning or development purposes. Using minikube we can create a Kubernetes cluster contained in a virtual machine (VM).

VirtualBox is a free, open source tool that can be used to quickly spin up virtual machines (VMs) with different operating systems and without having to use dedicated hardware.

In this tutorial we’ll be using minikube to interface with VirtualBox in order to create some Linux VMs on which we will host our local Kubernetes cluster.

To install minikube and VirtualBox, we’ll be using Chocolatey, which is a package manager for Windows that greatly simplifies the installation process.

Steps to set up minikube & VirtualBox on Windows 10

  1. Check Windows Powershell version installed and upgrade if required
  2. Check Windows .Net version and upgrade if required
  3. Install chocolatey
  4. Install minikube
  5. Ensure Hyper-V is turned off
  6. Install VirtualBox
  7. Start minikube (with driver defined as VirtualBox)

Step 1. Check Windows Powershell version

To use chocolatey we need Powershell V3 or greater to be installed.

We can check the version of Powershell using a command from within Powershell itself. Let’s get started!

To start, open the “Start” menu, search for “PowerShell,” and click it in the search results

In the Powershell window, enter the following command:

$PSVersionTable

The value of PSVersion will indicate the current version of Powershell, which in this case is version 5.1.19041.1320

Step 2. Check .NET version

To use chocolatey we need .NET Framework 4.5 or greater to be installed.

We can check the .Net version using another Powershell command.

Open Powershell as before, and then enter the following command:

Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse | Get-ItemProperty -Name version -EA 0 | Where { $_.PSChildName -Match '^(?!S)\p{L}'} | Select PSChildName, version

The current version of .Net will be shown

Step 3. Install Chocolatey

Open Powershell as an administrator and run the following commands.

First, check that the execution policy is not restricted:

Get-ExecutionPolicy

If it is restricted, then set the policy to All-Signed

Set-ExecutionPolicy AllSigned

Run the following command to install chocolatey:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Wait a few seconds for the command to complete.

Wait a few seconds for the command to complete, and if you don’t see any errors, then you should be ready to use Chocolatey! Try the following to command to check the installation:

choco -?

For more information see chocolatey.org

Step 4. Install minikube

With chocolately installed, we can now install minikube with the following command:

choco install minikube -y

Running the above command will install minikube and kubernetes-cli tools in your system.

Step 5. Disable Hyper-V

We’re going to use VirtualBox to provide our VMs, but Windows already has a built in virtualization technology called Hyper-V. VirtualBox and Hyper-V cannot run at the same time, so we are going to disable Hyper-V.

Press Windows Start and search for “control panel” and run the app

Select Programs and Features

In the left pane, click the Turn Windows features on or off link

Find the Hyper-V option and deselect it using the tick box.

Click OK to save the changes and reboot your PC.

Step 6. Install VirtualBox

Install Virtualbox using chocolatey:

choco install virtualbox -y

Step 7. Start minikube

Start minikube with the following command:

minikube start --driver=virtualbox

If minikube started successfully, you should now be able to interact with the local kubernetes cluster. In a Powershell window, try some of the following commands:

kubectl version
kubectl get nodes
kubectl get namespaces
kubectl config view

Leave a Reply