Installing Minishift or Minikube for prototyping

Minishift and Minikube offer a great way to get started with Lightbend Platform quickly. They run a single Kubernetes cluster and allow you to deploy Lightbend Platform apps and set up Lightbend Console on your local machine. If you already have one of them installed, skip to Running Minishift or Running Minikube.

Guides from OpenShift, "Getting Started with Minishift", and Kubernetes, "Install Minikube", provide detailed installation and configuration instructions. Both guides recommend using a hypervisor, but if resources are an issue, you can also install and run Minikube on a Linux-based platform in non-VM mode.

To help you get started quickly, the sections below provide the basic instructions for:

  • Installing a hypervisor, we provide instructions for KVM and Virtualbox

  • Installing Minishift or Minikube on both OS X and Ubuntu

  • Installing and running Minikube in non-vm mode

If you choose to follow the more extensive documentation to install Minishift or Minikube, please return to this guide to see how to start Minikube or Minishift using parameters that work best for Lightbend Platform.

You will need root access to install Kubernetes-based services directly on a workstation or in a cloud VM.

Install a hypervisor

If you prefer to run your cluster in a hypervisor, install Virtualbox or enable KVM as described in the following sections. You can also use xhyve as described here.

Virtualbox

Follow the steps appropriate for your operating system to install Virtualbox.

Mac
  1. Download and install VirtualBox: https://www.virtualbox.org/wiki/Downloads.

Ubuntu

Follow these steps to install Virtualbox on Ubuntu 16.04+:

  1. If you do not have curl, install it:

    ```bash
    sudo apt-get install curl
    ```
  2. Use the following command in a shell to download and install VirtualBox:

    ```bash
    sudo apt-get install virtualbox virtualbox-ext-pack
    ```

KVM on Ubuntu

To install KVM on Ubuntu, follow these steps:

  1. Verify whether your machine has VM support:

    egrep '(vmx|svm)' /proc/cpuinfo

    You should see vmx or svm flags listed in the list of output flags.

  2. Set Up the KVM Driver:

    sudo curl -L https://github.com/dhiltgen/docker-machine-kvm/releases/download/v0.7.0/docker-machine-driver-kvm -o /usr/local/bin/docker-machine-driver-kvm
    sudo chmod +x /usr/local/bin/docker-machine-driver-kvm
    
    sudo apt install libvirt-bin qemu-kvm
    sudo usermod -a -G libvirtd $USER
    sudo newgrp libvirtd
  3. Verify whether the kvm module is loaded:

    lsmod | egrep 'kvm'

    You should see something like the following:

    kvm_intel             212992  4
    kvm                   598016  1 kvm_intel
    irqbypass              16384  1 kvm
    The group name varies by version, for example, on 18.04 it is libvirt while on 16.04. libvrtd. You can always check your groups with: compgen -g.

Installing Minishift or Minikube

Follow the instructions for your operating system. Note that Minishift includes the oc command line tool, but Minikube requires you to install its command line tool, kubectl separately.

Install Minishift or Minikube on macOS

Using Homebrew, follow these steps to install Minikube or Minishift:

Minishift
brew cask install minishift
Minikube
brew cask install minikube
brew install kubernetes-cli

Next, follow the steps to run Minishift or Minikube

Install Minishift or Minikube on Ubuntu 16.04+

Log into an account with root access and install Minishift or Minikube using the following commands.

Minishift
cd /tmp/
export LATEST=`curl  https://api.github.com/repos/minishift/minishift/tags | jq '.[] .name' | sort -nr | head -n2 | tail -n 1`
tar -xvzf minishift.tgz
sudo cp LATEST/minishift /usr/local/bin/
sudo chmod +x /usr/local/bin/minishift
Minikube
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo cp minikube /usr/local/bin
sudo chmod +x /usr/local/bin/minikube
sudo snap install kubectl --classic

Next, follow the steps to run Minishift or Minikube

Install and run Minikube in non-VM mode

This section provides a script template to set up Minikube in a non-VM mode to minimize memory footprint and allow you to run Spark and other applications which have specific resource requirements. Running in non-VM mode is only available on Linux-based OS.

You may face issues accessing the Internet from within Minikube, one solution for Ubuntu is to make sure /run/systemd/resolve/resolv.conf matches /etc/resolv.conf.

In general KubeDNS uses your host DNS to make things work properly.

To install on a Linux-based OS in non-VM mode, create a script containing the following:

# get the latest minikube version

curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube
curl -Lo kubectl 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
chmod +x minikube
chmod +x kubectl
sudo rm -rf /usr/bin/minikube
sudo rm -rf /usr/bin/kubectl
sudo ln -s $(pwd)/minikube /usr/bin/minikube
sudo ln -s $(pwd)/kubectl /usr/bin/kubectl

if sudo minikube status ;  then
  sudo minikube delete
  sudo rm -rf ~/.minikube
  sudo rm -rf /etc/kubernetes/*
fi

export MINIKUBE_WANTUPDATENOTIFICATION=false
export MINIKUBE_WANTREPORTERRORPROMPT=false
export MINIKUBE_HOME=$HOME
export CHANGE_MINIKUBE_NONE_USER=true
mkdir -p $HOME/.kube
touch $HOME/.kube/config

# provide enough mem for spark

sudo minikube config set memory 4096

export KUBECONFIG=$HOME/.kube/config
sudo -E ./minikube start --vm-driver=none
sudo ./minikube addons enable kube-dns

# this for loop waits until kubectl can access the api server that Minikube has created

for i in {1..150}; do # timeout for 5 minutes
  ./kubectl get po &> /dev/null
  if [ $? -ne 1 ]; then
     break
 fi
 sleep 2
done
kubectl cluster-info

With Minikube running, install Helm locally.