Skip to content

Minikube on Ubuntu

Installing minikube is quite easy on Ubuntu, especially when using VirtualBox.

If you plan to allow more tweaking, you should chose to use KVM. But it's mainly a matter of taste.

Prerequisites

Install required OS packages

First install those packages:

sudo apt update
sudo apt install apt-transport-https virtualbox virtualbox-ext-pack
sudo apt update
sudo apt install apt-transport-https qemu-kvm libvirt-dev bridge-utils libvirt-daemon-system libvirt-daemon virtinst bridge-utils libosinfo-bin libguestfs-tools virt-top

Configure

Nothing to do here, things should work out-of-the-box.

Add vhost_net kernel module:

sudo modprobe vhost_net
sudo lsmod | grep vhost
echo "vhost_net" | sudo tee -a /etc/modules

Then, grant your user the libvm access

newgrp libvirt
sudo usermod -aG libvirt $USER

Install programs

minikube

wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube-linux-amd64
sudo mv minikube-linux-amd64 /usr/local/bin/minikube

Check that "install" is OK:

$ minikube version
minikube version: v1.25.2
commit: 362d5fdc0a3dbee389b3d3f1034e8023e72bd3a7

kubectl

curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl

Check that "install" is OK:

$ kubectl version -o json  --client
{
  "clientVersion": {
    "major": "1",
    "minor": "24",
    "gitVersion": "v1.24.0",
    "gitCommit": "4ce5a8954017644c5420bae81d72b09b735c21f0",
    "gitTreeState": "clean",
    "buildDate": "2022-05-03T13:46:05Z",
    "goVersion": "go1.18.1",
    "compiler": "gc",
    "platform": "linux/amd64"
  },
  "kustomizeVersion": "v4.5.4"
}

Start Minikube

driver selection

By default minikube will used a suitable driver for your installation, but it's good to check that it will do what you expect.

To check the selected value, simply type:

$ minikube config get driver
virtualbox

If it suits your need, you can continue, otherwise, change it according to your needs:

$ minikube config set driver virtualbox
   These changes will take effect upon a minikube delete and then a minikube start
$ minikube config set driver kvm2
   These changes will take effect upon a minikube delete and then a minikube start

You can get the list of available driver (not necessarily working on you configuration):

$ minikube config defaults driver
* virtualbox
* vmwarefusion
* kvm2
* vmware
* none
* docker
* podman
* ssh

start

To start minikube cluster, it is quite simple:

minikube start

Note

You can also use the --memory option to fine tune the allocated memory for minikube VMs. To start with 12G of RAM:

minikube start --memory=12G

Then you can see the status using kubectl:

$ kubectl cluster-info
Kubernetes control plane is running at https://192.168.39.6:8443
CoreDNS is running at https://192.168.39.6:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

Next steps...

Wip

Add more information and commands like minikube ssh...

Stopping

$ minikube stop
✋  Stopping node "minikube"  ...
🛑  1 node stopped.

Cleaning things up

$ minikube delete
🔥  Deleting "minikube" in kvm2 ...
💀  Removed all traces of the "minikube" cluster.

Refs

See those files if more informations are required: