Jupyter NoteBooks for Kubernetes via Google Summer of Code

This year I am mentoring another Google Summer of Code student, Konrad Djimeli (@djkonro on twitter). Konrad is a computer science student at the University of Buea, Buea in Cameroon. That seems far, but in this global world we are actually only one hour apart (CEST vs CAT time zones), which is much better than some of my colleagues in Australia and Vietnam.

Google Summer of Code (GSoc) is a great program that gives a chance to anyone in the world to learn open source and contribute to exciting projects. This year over 12,000 students from 104 countries take part in the program. It is the first year that the Cloud Native Computing Foundation (CNCF) is a mentoring organization which means the first year that GSoC students get a chance to work on Kubernetes.

The project

The heart of the project is to write Jupyter notebooks for Kubernetes. These notebooks will be aimed at new Kubernetes users trying to understand the API and the system.

Jupyter used to be known as IPython and is a way to share codes/notebooks, which can include equations, actual code, texts, visualizations etc. It is well known in the computation science communities. IPython still exists but focuses on being the interactive Python kernel for Jupyter. While Jupyter itself, brings the notebook format, the web application, a dedicated protocol etc.

Why ?

Because to learn Kubernetes, I think there is nothing better than an interactive shell and a Python client.

Golang is great and very powerful, but rapid prototyping via the Python shell is just very convenient. Combined with IPython auto-completion, shell features, notebooks and way more, this make it a great tool to help people get on-board with Kubernetes.

Plus, there is now a great Python Kubernetes client in the Incubator.

Quick Prototype

To give you a quick taste for what’s to come from Konrad and what you will be able to find really soon in the Python Kubernetes client, I had done a quick prototype. Yesterday we merged the prototype in the upstream client, so you will find some very early notebooks.

Start a Jupyter deployment and a NodePort service (testing) in your k8s cluster:

kubectl create -f https://raw.githubusercontent.com/kubernetes-incubator/client-python/master/examples/notebooks/docker/jupyter.yml

Once the Pod is running and assuming you are on minikube:

minikube service jupyter

This will open your browser and you will get inside the Jupyter Web application, browse inside the examples directory and then thenotebooks directory.

Pick the create_pod.ipynb notebook and you will see:

You can execute all the cells one by one, see the output, modify the cells etc.

You have an interactive shell with a connection to the Kubernetes API server.

We need to do lots of things of course:

  • Add interesting notebooks
  • Run these via proper RBAC settings so that you cannot access all the API resources
  • Improve data management and sharing of notebooks
  • Test support for Python 3.6
  • Setup a Jupyter server

So if you are a Python and Jupyter fan and want to help us this summer, please join us on GitHub , test, file issues, send us PR and let’s all help Konrad have a blast this summer and join our great Open Source communities.

Welcome Konrad to GSoC,

Like what you read? Give Sebastien Goasguen a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.