Introduction / Why This Is Needed
Minikube is a tool that runs a single-node Kubernetes cluster on your local Linux computer. It's an ideal environment for:
- Learning Kubernetes fundamentals without incurring cloud resource costs.
- Developing and testing containerized applications locally.
- Trial deployments of manifests (YAML files) before sending them to a production cluster.
After completing this guide, you will have a working Kubernetes cluster accessible via the standard CLI tool kubectl.
Requirements / Preparation
Before you begin, ensure that:
- You have a Linux distribution (Ubuntu/Debian/Fedora/CentOS, etc.) with
sudoaccess. - Virtualization is enabled in BIOS/UEFI (Intel VT-x or AMD-V technology). This is typically checked with:
If the output is empty, you need to enter the BIOS and activate the option (called "Virtualization Technology", "SVM Mode", or similar).grep -E --color '(vmx|svm)' /proc/cpuinfo - A driver is selected and installed. Minikube uses a driver to create a virtual machine. The most popular options are:
docker(recommended): requires Docker to be installed. Fast and efficient.virtualbox: requires VirtualBox to be installed. Suitable if Docker is undesirable.kvm2: for systems using KVM (primarily RHEL-compatible distributions). Requireslibvirtandqemu-kvmto be installed.
Installing the Selected Driver
If you choose Docker:
# For Ubuntu/Debian
sudo apt update
sudo apt install -y docker.io
sudo systemctl enable --now docker
sudo usermod -aG docker $USER
newgrp docker # Apply group changes without re-login
If you choose VirtualBox:
# For Ubuntu/Debian
sudo apt update
sudo apt install -y virtualbox virtualbox-ext-pack
# For Fedora
sudo dnf install -y VirtualBox
If you choose KVM2 (for Fedora/CentOS/RHEL):
sudo dnf install -y @virtualization
sudo systemctl enable --now libvirtd
sudo usermod -aG libvirt $USER
newgrp libvirt
sudo virt-install --connect qemu:///system --name minikube --memory 2048 --disk size=20 --os-variant generic --import
Step-by-Step Guide
Step 1: Installing Dependencies and Package Manager
Let's make sure the system is updated and basic utilities (curl, wget, gnupg) are installed.
For Ubuntu/Debian:
sudo apt update && sudo apt upgrade -y
sudo apt install -y curl wget gnupg apt-transport-https ca-certificates
For Fedora/CentOS/RHEL:
sudo dnf update -y
sudo dnf install -y curl wget gnupg2
Step 2: Downloading and Installing the Minikube Binary
We will download the latest stable version of Minikube. At the time of writing, this is v1.30.1.
# Download
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
# Install to system
sudo install minikube-linux-amd64 /usr/local/bin/minikube
Verify the installation:
minikube version
# Output should be approximately: minikube version: v1.30.1
Step 3: Starting the Kubernetes Cluster
Now let's start Minikube. Specify the driver corresponding to the software you installed. Example for Docker:
minikube start --driver=docker
What happens:
- Minikube checks for the driver's presence.
- Downloads the Kubernetes image (
k8s.gcr.io/kube-apiserverand others, ~1.5 GB). - Creates and starts a virtual machine/container named
minikube. - Configures
kubectl(local config~/.kube/config).
The first launch may take 5-10 minutes depending on your internet speed.
If you encounter a driver-related error, you can specify it explicitly:
# For VirtualBox
minikube start --driver=virtualbox
# For KVM2
minikube start --driver=kvm2
Step 4: Configuring kubectl and Checking Status
Install kubectl — the CLI tool for managing Kubernetes.
Installing kubectl (Ubuntu/Debian):
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
Verify that kubectl sees your cluster:
kubectl cluster-info
# Output should contain: Kubernetes control plane is running at https://192.168.49.2:8443
Check node status:
kubectl get nodes
# Expected output:
# NAME STATUS ROLES AGE VERSION
# minikube Ready control-plane 1m v1.26.3
You can also use the built-in Minikube command:
minikube status
# Should show: host: Running, kubelet: Running, apiserver: Running, kubeconfig: Configured
Verifying the Result
The cluster is ready for work if two conditions are met:
minikube statusshowsRunningfor all components.kubectl get nodesoutputs theminikubenode inReadystatus.
Quick test: deploy a simple application (nginx) and verify it's accessible.
# Deploy deployment
kubectl create deployment nginx --image=nginx
# Expose service as NodePort for external access from Minikube
kubectl expose deployment nginx --type=NodePort --port=80
# Find the port
kubectl get svc nginx
# In the PORT(S) column, you will see something like: 80:3xxxx/TCP
# Get Minikube IP (usually 192.168.49.2)
minikube ip
# Test access (replace <PORT> with the actual port)
curl $(minikube ip):<PORT>
# Should return the HTML code of the nginx page
Possible Issues
Error: Failed to start host: Creating host: create: precreate: Default frontend driver conflicts with another host...
Cause: A virtual machine named minikube already exists (possibly from a previous failed launch).
Solution:
minikube delete --all # Delete all clusters
minikube start --driver=<your_driver> # Start again
Error: Exiting due to DRV_NOT_FOUND: The specified driver "docker" is not installed
Cause: The docker driver is selected, but Docker itself is not installed or not running.
Solution: Install Docker (see Step 0) and ensure the service is active (sudo systemctl status docker).
Error: This computer doesn't have VT-x/AMD-v
Cause: Virtualization is disabled in BIOS/UEFI or the processor does not support it.
Solution: Enable virtualization in BIOS. If the processor is old, Minikube may not be supported. In this case, try the docker driver (does not require hardware virtualization) or none (runs directly on the host, but requires complex setup).
Memory/Disk Issues
Symptom: Minikube hangs at Downloading Kubernetes v1.xx.x or Starting cluster.
Solution: Increase the allocated memory. Minikube defaults to 2 GB. Launch with explicit parameters:
minikube start --driver=docker --memory=4096 --cpus=2
Error: Error: failed to download: context deadline exceeded
Cause: Network issues or download blocking. Solution:
- Check your internet connection.
- Try using a proxy or mirror. For example, with the Docker driver, you can pre-download images into a local repository.
After Reboot, kubectl Does Not See the Cluster
Cause: The kubectl configuration is stored in ~/.kube/config. Minikube may not automatically restore the connection.
Solution: Simply run minikube start again. It will copy the updated configuration. Or manually:
minikube update-context