mbunse / jupyterhub_demo

JupyterHub Demo on Azure Managed Kubernetes Cluster

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JupyterHub Demo Server

This is a collection of infrastructure as code for a kubernetes cluster on Azure with JupyterHub based on Zero to JupyterHub.

Approximated cost for one month uptime of this cluster: EUR 221.61 (EUR 7.29 per day).

The user authentication is based on hashing with salt. The salt is generated by the build_config.py script.

Commands to set up the cluster

# Build config.yaml and dump passwords
mkdir -p build
python3 build_config.py > build/password.txt
cd build
# Set up Azure CLI
az login
az provider register --name Microsoft.Network --wait
az provider register --name Microsoft.Compute --wait
az provider register --name Microsoft.Storage --wait
az provider register --name Microsoft.ContainerService --wait
# create ressource group
az group create --location westeurope --name Datalab-Demo --output table

# Create kubernetes cluster
az aks create --name jupyhub-demo-cluster --resource-group Datalab-Demo --generate-ssh-keys --node-count 3 --node-vm-size Standard_D2s_v3 --output table

# Save credentials for kubectl
az aks get-credentials --name jupyhub-demo-cluster --resource-group Datalab-Demo --output table

# Install kubectl
az aks install-cli 

# Check
kubectl get node

# Create service account for helm/tiller
kubectl --namespace kube-system create serviceaccount tiller
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller

# install helm
curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash
helm init --service-account tiller

# Add helm repo for JupyterHub
helm repo add jupyterhub https://jupyterhub.github.io/helm-chart/
helm repo update

# Install JupyterHub on cluster
helm install jupyterhub/jupyterhub --version=v0.6 --name=jupyhub-demo --namespace=jupyhub-demo --timeout 3600 -f build/config.yaml

# Set default namespace for kubectl
kubectl config set-context jupyhub-demo-cluster --namespace=jupyhub-demo
kubectl config use-context jupyhub-demo-cluster

# Check pods
kubectl get pod

# Check services
kubectl get svc

Commands to shut down the cluster

helm delete jupyhub-demo --purge
kubectl delete namespace jupyhub-demo
az aks delete --name jupyhub-demo-cluster --resource-group Datalab-Demo

About

JupyterHub Demo on Azure Managed Kubernetes Cluster


Languages

Language:Dockerfile 61.6%Language:Python 38.4%