Kubernetes Concepts · Part 0909

Minikube SetupComplete Installation on Ubuntu, Windows and macOS

A step-by-step demo from installing kubectl through checking virtualization, choosing the VirtualBox or Docker driver and installing Minikube, to starting and verifying the cluster.

Translated from the original Bangla with AI. If anything reads oddly, the Bangla version is the reference.

Minikube setup flow: install kubectl, pick the VirtualBox or Docker driver, install Minikube, then minikube start and kubectl get nodes showing a Ready node
FIG. 09 kubectl → driver (VirtualBox or Docker) → Minikube → minikube start → a Ready node.

In this tutorial, we will see how to create a basic Kubernetes cluster on your own computer using Minikube.

We will go through the whole process: installing kubectl, checking virtualization, configuring the Docker or VirtualBox driver, installing Minikube, starting the cluster and deploying a real application.

This beginner course uses Minikube because it is simple and enough for basic Kubernetes practice.

Minikube lets us create a small local Kubernetes cluster on our own computer.

For more advanced multi-node Kubernetes cluster setups, later advanced courses use tools like kubeadm.

1. The goal of this tutorial

The main goal of this demo is to create a working Kubernetes cluster with Minikube, then deploy an application inside that cluster and test it.

We will learn:

  1. How to install kubectl.
  2. How to check for virtualization support.
  3. How to use the VirtualBox or Docker driver.
  4. How to install Minikube.
  5. How to start a Minikube cluster.
  6. How to check the status of the Kubernetes cluster.
  7. How to deploy a test application.
  8. How to expose the application as a Service.
  9. How to access the application from the browser.
  10. How to delete the resources once testing is done.

Our complete workflow will be:

Install kubectl
       |
       ▼
Check Driver Requirements
       |
       ▼
Install Docker or VirtualBox
       |
       ▼
Install Minikube
       |
       ▼
Start Kubernetes Cluster
       |
       ▼
Verify Cluster
       |
       ▼
Deploy Application
       |
       ▼
Create Service
       |
       ▼
Access Application
       |
       ▼
Clean Up

2. What do you need before installing Minikube?

Before using Minikube, you need to understand four key things:

  1. kubectl
  2. Virtualization support
  3. A hypervisor or driver
  4. Minikube

This tutorial mainly uses a Linux Ubuntu environment.

But installation commands for Windows and macOS are shown as well.

ComponentWhat it does
kubectlThe CLI for managing a Kubernetes cluster
VirtualizationHardware support for running virtual machines
Hypervisor / DriverThe platform the Kubernetes environment runs on
MinikubeCreates and manages a local Kubernetes cluster

Important: with the Docker driver, Linux usually does not need hardware virtualization support. But if you want to use VirtualBox or another VM-based driver, virtualization support is required.

3. First, install kubectl

kubectl is Kubernetes' command-line tool.

We use kubectl to talk to a Kubernetes cluster from the terminal.

With it, we can manage:

  • Kubernetes clusters
  • Applications
  • Deployments
  • Services
  • Nodes
  • Pods

Put simply:

kubectl is the command-line tool we use to talk to Kubernetes and manage its resources.

It is good to install kubectl before Minikube, because after Minikube creates a cluster, it can update kubectl's configuration automatically.

Installing kubectl separately is not required, though. You can also use Minikube's bundled kubectl.

3.1 Installing kubectl on Ubuntu / Linux

Step 1: Check the CPU architecture

First, open a terminal.

uname -m

Possible output:

x86_64  → Intel / AMD 64-bit
aarch64 → ARM64

You need to download the kubectl binary that matches your CPU architecture.

Step 2: Download kubectl

For Ubuntu/Linux AMD64:

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"

For ARM64:

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl"

This command downloads the kubectl binary of Kubernetes' stable release.

Step 3: Verify the download

For security, it is good to verify the checksum of the downloaded binary.

For AMD64:

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"

On ARM64, use arm64 instead of amd64 in the URL.

Then:

echo "$(cat kubectl.sha256)  kubectl" | sha256sum --check

Expected output:

kubectl: OK

The binary and the checksum must be from the same release.

Step 4: Install kubectl

sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

This command installs the downloaded kubectl binary into the system's executable directory.

Step 5: Verify the installation

kubectl version --client

Expected example:

Client Version: v1.x.x

kubectl is now installed on Ubuntu/Linux.

3.2 Installing kubectl on Windows

On Windows, you can install kubectl with winget.

Step 1: Open PowerShell

Open PowerShell and run the following command:

winget install -e --id Kubernetes.kubectl

Once the installation is complete, open a new PowerShell window.

Step 2: Check the version

kubectl version --client

Expected:

Client Version: v1.x.x

Alternative: Chocolatey

If Chocolatey is already installed:

choco install kubernetes-cli

Note: kubectl may already be available with Docker Desktop. So before installing it separately, you can check:

kubectl version --client

3.3 Installing kubectl on macOS

On macOS, you can install kubectl with Homebrew.

Open a terminal.

brew install kubectl

Once the installation is complete:

kubectl version --client

Expected:

Client Version: v1.x.x

kubectl is now ready on macOS.

3.4 Why does kubectl configuration matter?

kubectl can work with several Kubernetes clusters.

For example:

kubectl → Local Minikube Cluster
kubectl → Cloud Kubernetes Cluster
kubectl → Company Production Cluster

So how does kubectl know which cluster to talk to?

For that, kubectl uses a configuration file called kubeconfig.

Default location:

~/.kube/config

When Minikube creates a Kubernetes cluster, it can update kubeconfig so that kubectl can connect to the new cluster.

Check the available contexts

kubectl config get-contexts

Check the current context

kubectl config current-context

Select the Minikube context

kubectl config use-context minikube

Important: it is good to check the current context when using kubectl, especially when you manage local and production clusters from the same computer.

4. Checking virtualization support

Minikube usually runs Kubernetes inside a virtual machine or another isolated environment.

With the VirtualBox driver, the computer needs virtualization support.

On Linux, you can check the CPU virtualization flags.

Common flags:

  • vmx → Intel virtualization
  • svm → AMD virtualization

Command:

grep -E --color 'vmx|svm' /proc/cpuinfo

If you get output, the CPU is exposing virtualization features.

If there is no output, you may need to enable virtualization in the BIOS/UEFI settings.

But finding the CPU flags alone does not mean the hypervisor is fully ready. The BIOS/UEFI, host configuration and VM environment all have to be right too.

With the Docker driver: Linux usually does not need this virtualization check. On macOS and Windows, though, Docker Desktop can have its own virtualization or WSL 2 requirements.

5. Installing a hypervisor or driver

A hypervisor is software that lets you run virtual machines on a computer.

This tutorial uses VirtualBox.

But several other hypervisors or drivers can be used with Minikube.

Operating SystemExample Driver Options
LinuxVirtualBox, KVM, Docker
WindowsVirtualBox, Hyper-V, Docker
macOSDocker, Supported VM Drivers

Minikube can also use Docker as a driver.

So in this tutorial, we will look at two setup methods:

Method A: start the Kubernetes cluster with the VirtualBox driver.

Method B: start the Kubernetes cluster with the Docker driver.

Why use a virtual machine?

Some advantages of a VM-based setup:

  • A virtual machine is easy to delete and recreate.
  • You get comparatively good isolation from the host system.
  • Virtual machine snapshots can be used.
  • The Kubernetes environment can be managed separately.

The Docker driver has its advantages too.

If Docker is already installed, you can run Minikube without installing a separate hypervisor.

6. Installing Minikube

With kubectl and a compatible driver ready, we need to install the Minikube command-line tool.

Minikube is the tool that creates and manages a local Kubernetes cluster.

6.1 Installing Minikube on Ubuntu / Linux

First, check the CPU architecture:

uname -m

For AMD64:

curl -LO https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-amd64

Install it:

sudo install minikube-linux-amd64 /usr/local/bin/minikube

For ARM64:

curl -LO https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-arm64

Then:

sudo install minikube-linux-arm64 /usr/local/bin/minikube

Check the version:

minikube version

6.2 Installing Minikube on Windows

Open PowerShell.

winget install -e --id Kubernetes.minikube

Once the installation is complete, restart PowerShell.

Check:

minikube version

6.3 Installing Minikube on macOS

With Homebrew:

brew install minikube

Then:

minikube version

Expected example:

minikube version: v1.x.x

Minikube is now installed.

Basic Minikube commands

minikube start
minikube status
minikube stop

Here:

  • minikube start → starts the Kubernetes cluster.
  • minikube status → shows the cluster's status.
  • minikube stop → stops the Kubernetes cluster.

Official installation guide:

https://minikube.sigs.k8s.io/docs/start/

7. Method A — Starting Minikube with VirtualBox

The original demo for this tutorial uses the VirtualBox driver.

VirtualBox has to be installed and properly configured first.

Official website:

https://www.virtualbox.org/

A common way to install it from the distribution repository on Linux/Ubuntu:

sudo apt update
sudo apt install -y virtualbox

Package availability, kernel modules and the supported VirtualBox version depend on the Ubuntu release, though.

To verify the installation:

VBoxManage --version

Step 1: Start the cluster with the VirtualBox driver

minikube start --driver=virtualbox

When you run this command, Minikube:

  1. Downloads the required Minikube ISO/image.
  2. Creates a virtual machine inside VirtualBox.
  3. Installs and configures the Kubernetes components.
  4. Starts the Kubernetes cluster.
  5. Configures kubeconfig for kubectl.

Architecture

Your Laptop
     |
     ▼
 VirtualBox
     |
     ▼
Virtual Machine
     |
     ▼
   Minikube
     |
     ▼
Kubernetes Cluster
     |
     ├── API Server
     ├── etcd
     ├── Scheduler
     ├── Controller Manager
     ├── Kubelet
     └── Container Runtime

When this process completes, a local Kubernetes cluster is ready.

Step 2: Check the Minikube status

minikube status

Step 3: Check the Kubernetes nodes

kubectl get nodes

Expected example:

NAME       STATUS   ROLES           AGE   VERSION
minikube   Ready    control-plane   2m    v1.x.x

Here, Ready means the Kubernetes node is in the ready state.

8. Method B — Starting Minikube with the Docker driver

Besides VirtualBox, Minikube can start a cluster with the Docker driver.

If Docker Engine or Docker Desktop is already installed, this is an easy approach.

To use the Docker driver, Docker Engine has to be running.

Step 1: Verify the Docker installation

Open a terminal:

docker --version

Then:

docker info

To test whether Docker can run a container:

docker run --rm hello-world

Expected output:

Hello from Docker!

If the Docker service is not running on Linux:

sudo systemctl enable --now docker

If you use Docker Desktop, the application has to be open and the engine running.

Step 2: Start Minikube with the Docker driver

minikube start --driver=docker

When you run this command, Minikube creates the Kubernetes cluster using Docker.

Docker driver architecture

Your Computer
       |
       ▼
Docker Engine / Docker Desktop
       |
       ▼
Minikube Node Container
       |
       ▼
Kubernetes Components
       |
       ├── API Server
       ├── etcd
       ├── Scheduler
       ├── Controller Manager
       ├── Kubelet
       └── Container Runtime
       |
       ▼
Kubernetes Cluster Ready

Here, a Docker-based node environment is used instead of a VirtualBox virtual machine.

Important: even with Minikube's Docker driver, a CRI-compatible runtime such as containerd may be used inside the Kubernetes node.

Here, Docker mainly acts as the driver that hosts the Kubernetes node environment.

Step 3: Make Docker the default Minikube driver

If you don't want to type --driver=docker every time:

minikube config set driver docker

After that:

minikube start

alone will use the Docker driver, as long as the profile and configuration are compatible.

Step 4: Check the Minikube status

minikube status

Expected example:

minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured

If all components are running, the cluster is ready.

Step 5: Check the Kubernetes node

kubectl get nodes

Expected:

NAME       STATUS   ROLES           AGE   VERSION
minikube   Ready    control-plane   2m    v1.x.x

Here, Minikube has created a single-node Kubernetes cluster.

Step 6: Check the Kubernetes system Pods

kubectl get pods -A

Example output:

NAMESPACE     NAME                        STATUS
kube-system   coredns-xxxxx               Running
kube-system   etcd-minikube               Running
kube-system   kube-apiserver-minikube     Running

There may be more system Pods, depending on the Kubernetes version and configuration.

Step 7: Check Minikube inside Docker

With the Docker driver, the Minikube node runs inside a Docker-based container environment.

To check:

docker ps

You will see a Minikube-related container here.

This confirms that Minikube is using the Docker driver.

9. VirtualBox driver vs Docker driver

FeatureVirtualBox DriverDocker Driver
Kubernetes EnvironmentVirtual MachineContainer-based Node
VirtualBox RequiredYesNo
Docker RequiredNoYes
Hardware VirtualizationRequiredUsually not needed on Linux
Setup ComplexityMediumEasy, if Docker is installed
IsolationVM-basedContainer-based
Local Kubernetes PracticeYesYes
Start Commandminikube start --driver=virtualboxminikube start --driver=docker

Both approaches work for learning Kubernetes.

With the VirtualBox driver, Kubernetes runs inside a VM-based environment.

With the Docker driver, Kubernetes runs inside a Docker-based node environment.

The application deployment steps that follow in this tutorial are the same for both drivers.

Was this guide helpful?

Search the archive

Press Esc to close