1 of 11

Amalthea

Running Jupyter Servers in a Kubernetes-native way

2 of 11

What is Amalthea?

  • Kubernetes operator for Jupyter servers
  • Written in Python using a framework specifically for k8s operators called Kopf
  • Used in production at Renku (https://renkulab.io) to run interactive data analysis sessions for users

2

3 of 11

Why is Amalthea?

  • Renku is deployed on Kubernetes
  • Using a central configurable HTTP proxy replicates native k8s capabilities (i.e. Ingress)
  • The need to heavily modify the Kubespawner to control resources that are usually not directly provided (i.e. PVCs, Secrets, Configmaps)

3

4 of 11

steak.yaml

4

apiVersion: restaurant/v1alpha1

kind: SteakDinner

metadata:

name: tasko

namespace: tasko

spec:

side: fries

level: mediumRare

type: tBone

Kitchen

Potatoes

Steak

SeasonSteak

CutPotatoes

CookPotatoes

CookSteak

SteakDinner

5 of 11

The k8s operator pattern for Amalthea

5

Custom resource

apiVersion: amalthea.dev/v1alpha1

kind: JupyterServer

metadata:

name: my-jupyter-server

namespace: tasko

spec:

routing:

host: tasko.renku.dev

auth:

token: verySecretToken

patches: []

Operator

Statefulset

Configmap

PVC

Ingress

Service

Secret

JupyterServer

6 of 11

Flexibility through templating and patching

6

Custom resource

apiVersion: amalthea.dev/v1alpha1

kind: JupyterServer

metadata:

name: my-jupyter-server

namespace: tasko

spec:

routing:

host: tasko.renku.dev

auth:

token: verySecretToken

patches: []

Operator

Parse custom resource (CR)

Read Jinja templates

Render Jinja templates with values from CR

Apply patches

“kubectl apply”

7 of 11

What can I do with patches?

Anything you want…

  • Add sidecar containers
  • Add initialization containers
  • Remove containers or any other “default” resource
  • Add a custom authentication flow
  • Inject environment variables and/or secrets

7

8 of 11

Auth flow

8

9 of 11

In summary…

  • Amalthea introduces two major changes to the way how JupyterHub and the KubeSpawner spawn and expose Jupyter servers in Kubernetes:
    • how servers are deployed: operator pattern, k8s as single source of truth, no internal state
    • what is deployed: no more need for a CHP, separation of concerns (auth), flexibility through patching
  • The guiding principle of Amalthea is to leverage Kubernetes to the maximum.
  • We see Amalthea as middleware for developers to build applications on. We ourselves build a notebook service on top of Amalthea.

9

10 of 11

Useful links

10

11 of 11

Demo

11