Deploy Kubeflow on Ubuntu, Windows and MacOS

Overview

Kubeflow is a novel open source tool for Machine Learning workflow orchestration on Kubernetes. It has great powers, but deploying it may not be so easy, depending on how and where you deploy your Kubernetes.

This tutorial will show you an easy way to deploy Kubeflow using MicroK8s, a lightweight version of Kubernetes, in a few simple steps.

What you’ll learn

  • How to deploy MicroK8s on Ubuntu, Windows or MacOS
  • How to deploy Kubeflow on top of MicroK8s
  • How to access your Kubeflow dashboard

What you’ll need

  • Desktop or Virtual Machine with Ubuntu (16.04 LTS or above), Windows or MacOS
  • A minimum of 4 CPU, 16GB RAM, 50GB Disk (recommended 8 CPU, 32GB RAM, 60GB Disk)
  • Hyper V, if using Multipass on a Windows machine (not available on Windows 10 Home)
  • Some basic command-line knowledge

Access an Ubuntu terminal

The first thing we need to do is to access an Ubuntu terminal.

On Ubuntu

On an Ubuntu machine, you simply need to look for the terminal application or use the Ctrl + Alt + t keyboard shortcut.

On Windows or MacOS

On Windows or MacOS, a simple way of getting an Ubuntu terminal is to download and install Multipass, then start a Multipass VM that matches the minimum requirements for deploying Kubeflow:

multipass launch --name kubeflow --mem 16G --disk 50G --cpus 4

Then, to enter this VM:

multipass shell kubeflow

Install MicroK8s

In this step you will install MicroK8s, a minimal, lightweight Kubernetes you can run and use on practically any machine. It can be installed with the following command:

sudo snap install microk8s --classic

Then, verify the success of the installation:

sudo microk8s status --wait-ready

Join the “microk8s” group

MicroK8s creates a group to enable seamless usage of commands which require admin privilege.

To add your current user to the group and gain access to the .kube caching directory, run the following two commands:

sudo usermod -a -G microk8s $USER
sudo chown -f -R $USER ~/.kube

Exit and re-enter the Ubuntu session for permissions to take effect.

Deploy Kubeflow

Finally we are able to deploy all the Kubernetes services behind Kubeflow.

Let’s start by enabling the dns, dashboard and storage services:

microk8s.enable dns dashboard storage

Then, to start Kubeflow:

microk8s.enable kubeflow

Starting these services can take several minutes. You can keep track of the status of this process with the following command:

microk8s.kubectl get all --all-namespaces

Once the deployment is successful, you will see see the following prompt:

Congratulations, you made it!

Access the Kubeflow dashboard

Once deployed, it’s time to access the Kubeflow dashboard and play around with it.

Option 1: on Ubuntu desktop

If running Ubuntu locally, you simply need to open a web browser window and access the link given in the previous step. In our example, the link is: http://10.64.140.43.xip.io

Option 2: on Multipass or another VM

If running Ubuntu in a Virtual Machine, we need to create a SOCKS proxy. This can be done as follows:

  • Logout from the current session
  • Re-establish connection to the machine using ssh, enabling SOCKS proxy with the -D9999 parameter.

Examples:

ssh -D9999 ubuntu@<machine_public_ip>

or

ssh -D9999 multipass@<machine_public_ip>

On your computer, go to Settings > Network > Network Proxy, and enable SOCKS proxy pointing to: 127.0.0.1:9999

On a new browser window, access the link given in the previous step. In our example, this link is: http://10.64.140.43.xip.io

As you seen, the credentials to access the dashboard are available in the MicroK8s output.

Enjoy kubeflow!

Congratulations! You are now able to start your Kubeflow journey and start building, deploying and scaling models.

To know more about Kubeflow visit:

In case you need help to deploy and maintain your Kubeflow deployments, you will find more information about the support options provided by Canonical on our Kubeflow consulting page.