Jupyter Lab container for Kubeflow

Ivan N.
Datasparq Technology
2 min readNov 12, 2020

How to get rid of Jupyter Notebook and use Jupyter Lab instead.

The Problem

We at DataSparQ love Kubeflow. But we don’t like the default Notebook options that are on the menu:

“You can have any colour you want, as long as it’s black”

They all come with:

  • Jupyter Notebook: which does not have dark mode or the ability to paste in the terminal
  • Lack of (working) sudo, which comes apparent only after you realise apt get is the only way to install packages like ssh-keygen
  • Default packages are fine if you need Tensorflow. Besides you can always install from your requirements file. (ok, maybe that one is the least annoying…)
  • Python 3.6; which is great, until you enter dependency limbo because you need that one package. And unlike the python packages, you can’t update the python version because of the lack of sudo.

The solution

Luckily for me, the lovely people behind Kubeflow have thought of the petty, dark-mode-liking developers like myself and have left us the ability to be the masters of our own containers. However, they did not want to make this job too easy by having up-to-date documentation.

Luckily for you, dear reader, I have already been through the minefield of Jupyter parameters and have found a working path. It is all available on GitHub:

Source Code

The Explanation

First a few warnings:

Photo by Ben Hershey on Unsplash

This container will run without any authentication and will have password-less sudo.

Here’s what comes in the box (container):

  • Python 3.8 ( or whichever is on the latest jupyter/scipy-notebook)
  • Jupyter extensions: git, dask
  • Common terminal tools: ssh-keygen, vim, curl, jq
  • kubectl and helm (which is a very edge case use)
  • A bash script that runs Jupyter lab with the “correct” settings

I encourage you to clone the repo and add/remove any packages you may need. Then it’s up to you to push that image to a repo that is accessible by your kubernetes cluster.

…or you can be lazy and paste ivndigint/kubeflow-jupyter:latest in the ‘Image’ field of the Kubeflow notebook window.

The best way to use this image (or its fork) is as a “BASE” layer and then add any project dependencies on top of it:

I have found this to be a good way to prevent any dependency mismatch between the different environments.

--

--

Ivan N.
Datasparq Technology

When the machines take over, I will be on the winning side 🤖