JupyterHub In Kubernetes Cluster (google cloud + auth0) In 10 minutes.

without Helm

Before starting, you guys need :

  1. Account on Google Could Platform with kubernetes cluster already created and kubectl must be of that cluster.
  2. Account in AuthO with application.
  3. Knowledge on Jupyterhub, Kubernetes and Auth0.

In this tutorial i will be only focusing in deployment part. So, i will not be going in depth in anything in particular. This Tutorial is divided into three part. If you go along the parts and its steps, you will be up and runing jupyterhub in kubernetes cluster.

Note : persistent disk is not applied in this project. So, file are not saved after pods are deleted.

Too Lazy to go through this guide

Click here for boiler plate.

Part One : Create a App’s deployment file

  1. Create a JupyterHub’s app deployment file.

saurssaurav/jupyterhub-kube-oauth:latest is a jupyterhub image containing kubespwaner and oauthenticator. It's docker file is inside jupyterhub_oauth_kubespawner_docker_file folder in boiler plate provided above.

2. Put a value of following keys in deployment.yaml file.

AUTH0_SUBDOMAIN, OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET.

But leave a OAUTH_CALLBACK_URL for now as we don’t have endpoint of cluster yet.

Part Two : Create configmap of jupyterhub_config.py and deploy the app

saurssaurav/fusesingleuser:latest is image derived from jupyterhub/singleuser. You can use jupyterhub/singleuser:latest instead.

  1. Use Below command to create configmap named jupyterhub-config of jupyterhub_config.py
kubectl create configmap jupyterhub-config --from-file=./jupyterhub_config.py

To check if configmap exits

kubectl get configmap -o yaml

2. Now time to deploy deployment.yaml.

kubectl apply -f deployment.yaml

3. Get a External-IP of the jupyterhub service

kubectl get service

It may take sometime for external IP to generate.

Part Three : Set a callback-URL and redeploy

1. Open deployment.yaml and add the external ip of cluster into OAUTH_CALLBACK_URL’s key as show below.

              name: OAUTH_CALLBACK_URL
value: "http://<external-ip>:8000/hub/oauth_callback"

2. Add http://<external-ip>:8000/hub/oauth_callback in auth0 Allowed Callback URLs

3. Re-deploy a deployment.yaml file

kubectl delete deployment jupyterhub
kubectl apply -f deployment.yaml  
// you must be in deployment.yaml file destination

4. Browse a http://<external-ip>:8000 into Browser. Jupyterhub should be up and running.