sodcalculator

10 Tech How-To

Install Minikube on Ubuntu: Step-by-Step Guide

Guide 10-4934 · Updated · Step by step

To install Minikube on Ubuntu, you need to install a hypervisor (like Docker or KVM), download the Minikube binary, and then start your cluster with minikube start. This guide walks through the entire process, including prerequisites, troubleshooting, and common questions.

Prerequisites

Before installing Minikube, ensure your Ubuntu system meets the following requirements:

  • Hardware: At least 2 CPUs, 2GB of free memory, and 20GB of free disk space. Minikube may not start if your system has less than this.
  • Operating System: Ubuntu 18.04 or newer (64-bit). Older versions may not be supported by the latest Minikube releases.
  • Virtualization support: Check if your CPU supports hardware virtualization with egrep -c '(vmx|svm)' /proc/cpuinfo. A result of 1 or more means it’s supported. If not, you may need to enable it in your BIOS or use a different driver.
  • Internet connection: Minikube downloads Kubernetes components and container images during startup.

Choosing a Driver

Minikube needs a driver to create a virtual machine or container that runs the Kubernetes cluster. The most common options on Ubuntu are:

  • Docker (recommended for beginners): Uses Docker containers to run Kubernetes. Requires Docker installed and the current user added to the docker group.
  • KVM (better performance): Uses KVM virtualization. Requires the qemu-kvm and libvirt-daemon-system packages, and the user must be in the libvirt group.
  • VirtualBox: Works well but is slower than KVM and requires the VirtualBox package.
  • None (bare metal): Runs Kubernetes directly on the host without a VM. Only recommended for Linux systems with Docker installed, as it may expose host services.

Installation Steps

Follow these steps to install Minikube on Ubuntu. The commands assume you’re using Docker as the driver, which is the simplest setup.

  1. Install Docker (if not already installed):
    sudo apt update && sudo apt install -y docker.io
    Start Docker and enable it to run at boot:
    sudo systemctl enable --now docker
    Add your user to the docker group to run Docker commands without sudo:
    sudo usermod -aG docker $USER
    Log out and back in for the group change to take effect.
  2. Install Minikube:
    Download the latest Minikube binary (check the official releases page for the current version):
    curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
    Install it to /usr/local/bin:
    sudo install minikube-linux-amd64 /usr/local/bin/minikube
  3. Install kubectl:
    Minikube doesn’t include kubectl, so install it separately:
    curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
    Make it executable and move it to your PATH:
    chmod +x kubectl && sudo mv kubectl /usr/local/bin/
  4. Start Minikube:
    minikube start --driver=docker
    The first start may take a few minutes as it pulls container images. Once done, you’ll see a message like “Done! kubectl is now configured to use \”minikube\” cluster”.
  5. Verify the cluster:
    kubectl get nodes
    You should see a node named minikube with status Ready.

Common Issues and Fixes

Here are some frequent problems you might encounter and how to resolve them:

  • Docker permission denied: If you get a permission error when running Docker commands, the user isn’t in the docker group. Run sudo usermod -aG docker $USER and re-login.
  • Driver not supported: If you see “X509: certificate signed by unknown authority” or “driver ‘docker’ not found”, ensure Docker is installed and running (sudo systemctl status docker).
  • Insufficient resources: If Minikube fails with a message about memory or CPU, try increasing resources: minikube start --driver=docker --cpus=4 --memory=4096.
  • KVM not available: If you chose KVM but get a libvirt error, install the required packages and add your user to the libvirt group: sudo apt install qemu-kvm libvirt-daemon-system && sudo usermod -aG libvirt $USER.
  • Network issues: If image pulls fail, check your internet connection and proxy settings. You can also set a different registry mirror in the Docker daemon config.

Using Minikube

Once your cluster is running, you can interact with it using kubectl. Here are a few common commands:

  • kubectl get pods -A – list all pods in all namespaces.
  • kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10 – create a simple deployment.
  • kubectl expose deployment hello-minikube --type=NodePort --port=8080 – expose the deployment.
  • minikube service hello-minikube – open the service in your browser.
  • minikube dashboard – launch the Kubernetes dashboard.

Stopping and Deleting the Cluster

When you’re done, you can stop the cluster to free up resources without deleting your work:

minikube stop

To start it again later, just run minikube start.

To completely delete the cluster and all its data (including persistent volumes), use:

minikube delete

This is useful if you want a clean slate or if the cluster becomes corrupted.

Frequently Asked Questions

Do I need to install Docker separately?

Yes, if you plan to use the Docker driver, you must install Docker first. Alternatively, you can use the KVM driver, which doesn’t require Docker, but it requires libvirt packages. The Docker driver is generally the easiest for beginners.

Why does minikube start take so long?

The first start downloads Kubernetes components and container images, which can take several minutes depending on your internet speed. Subsequent starts are much faster because the images are cached. If it seems stuck, you can check the logs with minikube logs.

Can I run Minikube on a VM inside Ubuntu?

Yes, but you need to enable nested virtualization. Minikube also requires hardware virtualization support, which must be passed through to the VM. This can be complex, so it’s often easier to run Minikube directly on a physical machine.

How do I update Minikube?

To update Minikube, download the latest binary and replace the old one. You can check your current version with minikube version. It’s also a good idea to update kubectl to match the Kubernetes version Minikube uses.

What is the difference between minikube and kind?

Minikube creates a single-node Kubernetes cluster in a VM or container, while kind (Kubernetes in Docker) runs multiple nodes as Docker containers. Minikube is more feature-rich with a built-in dashboard and add-ons, while kind is lighter and faster for CI/CD testing. Both are for local development.

Is Minikube safe for production use?

No, Minikube is designed for local development and testing, not for production workloads. It lacks high availability, scaling, and security features required in production. For production, consider managed Kubernetes services or a full cluster setup.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →