Minikube is a powerful tool that lets you run Kubernetes locally on your Ubuntu machine. Whether you’re a developer testing Kubernetes applications or learning container orchestration, Minikube provides a lightweight, single-node Kubernetes cluster that’s perfect for development and testing purposes.
In this comprehensive guide, I’ll walk you through everything you need to know about installing Minikube on Ubuntu Linux, including prerequisites, installation methods, and verification steps.
What is Minikube?
Minikube is an open-source tool that runs a single-node Kubernetes cluster inside a virtual machine (VM) or container on your local system. It’s designed to make it easy for developers to develop and test Kubernetes applications locally without requiring a full-scale cluster.
Key Features:
- Supports the latest Kubernetes releases
- Cross-platform compatibility (Linux, macOS, Windows)
- Multiple container runtimes (Docker, containerd, CRI-O)
- Advanced features like LoadBalancer, filesystem mounts, and FeatureGates
- Add-ons for DNS, dashboard, monitoring, and more
Prerequisites
Before installing Minikube on Ubuntu, ensure your system meets these requirements:
System Requirements
- CPU: 2 CPUs or more
- Memory: 2GB of free memory (4GB recommended)
- Disk Space: 20GB of free disk space
- Ubuntu Version: Ubuntu 18.04 or later
- Internet Connection: Required for downloading packages
Required Software
- A container or virtual machine manager such as:
- Docker (recommended)
- KVM
- VirtualBox
- Podman
Step 1: Update System Packages
Start by updating your Ubuntu system to ensure all packages are up to date:
sudo apt update && sudo apt upgrade -y Step 2: Install Docker (Recommended Driver)
Docker is the most popular and recommended driver for Minikube. If you don’t have Docker installed, follow these steps:
# Remove old versions sudo apt remove docker docker-engine docker.io containerd runc # Install dependencies sudo apt install -y apt-transport-https ca-certificates curl software-properties-common # Add Docker's official GPG key curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg # Set up the stable repository echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null # Install Docker Engine sudo apt update sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin # Add your user to the docker group sudo usermod -aG docker $USER && newgrp docker # Verify Docker installation docker --version Step 3: Install kubectl (Kubernetes CLI)
kubectl is the command-line tool for interacting with Kubernetes clusters:
# Download the latest kubectl binary curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" # Validate the binary (optional) curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256" echo "$(cat kubectl.sha256) kubectl" | sha256sum --check # Install kubectl sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl # Verify installation kubectl version --client Step 4: Install Minikube
Now let’s install Minikube using the official binary:
Method 1: Direct Binary Installation (Recommended)
# Download the latest Minikube binary curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 # Install Minikube sudo install minikube-linux-amd64 /usr/local/bin/minikube # Verify installation minikube version Method 2: Using Debian Package
# Download the Debian package curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb # Install the package sudo dpkg -i minikube_latest_amd64.deb # Verify installation minikube version Step 5: Start Minikube Cluster
Start your first Minikube cluster with Docker as the driver:
# Start Minikube with Docker driver minikube start --driver=docker # For more memory allocation (recommended for production-like testing) minikube start --driver=docker --memory=4096 --cpus=2 ``` You should see output similar to: ``` 😄 minikube v1.32.0 on Ubuntu 22.04 ✨ Using the docker driver based on user configuration 👍 Starting control plane node minikube in cluster minikube 🚜 Pulling base image ... 🔥 Creating docker container (CPUs=2, Memory=2200MB) ... 🐳 Preparing Kubernetes v1.28.3 on Docker 24.0.7 ... 🔎 Verifying Kubernetes components... 🌟 Enabled addons: storage-provisioner, default-storageclass 🏄 Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default Step 6: Verify the Installation
Check the status of your Minikube cluster:
# Check cluster status minikube status # Get cluster information kubectl cluster-info # View all nodes kubectl get nodes # Check running pods in all namespaces kubectl get pods -A ``` Expected output for `minikube status`: ``` minikube type: Control Plane host: Running kubelet: Running apiserver: Running kubeconfig: Configured Step 7: Access the Kubernetes Dashboard
Minikube includes a web-based Kubernetes Dashboard:
# Enable the dashboard addon minikube addons enable dashboard # Open the dashboard in your browser minikube dashboard This will automatically open the Kubernetes Dashboard in your default web browser.
Useful Minikube Commands
Here are essential commands for managing your Minikube cluster:
bash
# Stop the cluster minikube stop # Delete the cluster minikube delete # Pause the cluster (saves resources) minikube pause # Unpause the cluster minikube unpause # SSH into the Minikube VM minikube ssh # Check Minikube IP address minikube ip # View Minikube logs minikube logs # List available addons minikube addons list # Enable an addon (example: metrics-server) minikube addons enable metrics-server # Access service in browser minikube service <service-name> Configuring Minikube
Setting Default Driver
Set Docker as the default driver for future starts:
minikube config set driver docker Adjusting Resources
Modify CPU and memory allocation:
# Delete existing cluster first minikube delete # Start with custom resources minikube start --cpus=4 --memory=8192 --disk-size=40g Selecting Kubernetes Version
Start Minikube with a specific Kubernetes version:
minikube start --kubernetes-version=v1.27.0 Minikube vs. Kind vs. K3s
While Minikube is excellent for local development, here’s a quick comparison:
| Feature | Minikube | Kind | K3s |
|---|---|---|---|
| Setup Speed | Moderate | Fast | Fast |
| Resource Usage | Higher | Lower | Lower |
| Multi-node | Limited | Full Support | Full Support |
| Dashboard | Built-in | Manual | Manual |
| Best For | Beginners | CI/CD | Edge/IoT |
Best Practices
- Resource Management: Allocate adequate resources based on your workload
- Regular Updates: Keep Minikube and kubectl updated to the latest versions
- Use Profiles: Create different profiles for different projects:
minikube start -p project-name - Clean Up: Regularly delete unused clusters to free up resources
- Enable Only Required Addons: Too many addons can slow down your cluster
Conclusion
Installing Minikube on Ubuntu is straightforward and provides an excellent platform for learning Kubernetes and developing cloud-native applications locally. With this guide, you now have a fully functional local Kubernetes cluster running on your Ubuntu machine.
Whether you’re preparing for Kubernetes certifications, testing microservices architectures, or learning container orchestration, Minikube gives you a production-like environment without the complexity of managing a full cluster.
Start experimenting with Kubernetes deployments, services, and configurations in your local Minikube cluster today!