Minikube on KVM on Linux Mint 19.1

0

In a previous blog post I wrote about running Minikube on Windows. I ended with the suggestion that getting Minikube working might be much easier on Linux. Thus I installed Linux Mint (as dual-boot) on my laptop and gave it a shot. The steps I took to get it working are described here.

Challenges installing Mint

UEFI

First I was having some issues getting Mint installed as dual boot OS. First I already had an UEFI Windows 10 installed. I needed to figure out how to create an USB boot disk which would also be UEFI compatible. I used Rufus for this and used DD mode to write the ISO to the USB stick. I installed the boot loader on my primary disk (which was selected as default). Also for ease of use I did not create a separate swap partition (my laptop has 32Gb of RAM) or home partition. Also make sure Secure Boot is disabled (BIOS setting) and Windows 10 fast startup is also disabled.

Graphics

I had quite a new NVidia graphics card (GTX 1060) and the open source NVidia drivers (Nouveau) did not work for me thus I needed to boot with the ‘nomodeset’ kernel parameter (see here under solving freezes). After the installation of proprietary drivers and reboot, still it did not work. I did the following to add a repository with newer graphics drivers and used the Mint Driver Manager to install a newer version. After that it worked.

sudo add-apt-repository ppa:graphics-drivers/ppa

Minikube on Mint

Installing KVM

There are of course various virtualization technologies available. I’m used to VirtualBox but thought I’d try out KVM for a change. I installed KVM and related things using the following (loosely based on this):

sudo apt-get update sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils libvirt-clients libvirt-daemon-system apt-transport-https ebtables iptables dnsmasq virt-manager

Next I added my current user to the libvirt group.

sudo usermod -a -G libvirt $(whoami)

This is required so the user can use virtualization. You can use newgrp to add the group to the current session without having to logout and login again. Libvirt provides an abstraction for various virtualization technologies making it easier to manage them with various tools such as virt-manager, virsh or OpenStack.

I had some struggles with firewalld. I uninstalled it. You need to restart libvirtd after uninstalling firewalld for Minikube to be able to create VMs.

Installing Docker

After having installed KVM, I installed Minikube and related. In order to work with Minikube you don’t need just Minikube but also some additional tools like Kubectl and Docker.

The installation of Docker is described here. Linux Mint is Ubuntu based so the following works:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –

sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable”

sudo apt-get update

sudo apt-get install -y docker-ce

Installing Minikube

Install Minikube

curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube

sudo mv minikube /usr/local/bin

Install the KVM2 driver

curl -LO https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2 && sudo install docker-machine-driver-kvm2 /usr/local/bin/

Start Minikube

minikube start --vm-driver=kvm2

Minikube dashboard

First start the dashboard with

minikube dashboard

Next start a proxy

kubectl proxy

And open it in a browser by going to: http://localhost:8001/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/#!/overview?namespace=default

Have fun!

About Author

Maarten is a software architect and Oracle ACE. Over the past years he has worked for numerous customers in the Netherlands in developer, analyst and architect roles on topics like software delivery, performance, security and other integration related challenges. Maarten is passionate about his job and likes to share his knowledge through publications, frequent blogging and presentations.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.