Skip to main content

JupyterHub

helm repo add jupyterhub https://hub.jupyter.org/helm-chart
helm repo update
# helm install jupyterhub/<helm chart name> --version <helm chart version>
# Create JupyterHub.
helm repo add jupyterhub https://jupyterhub.github.io/helm-chart && \
helm repo update
NAMESPACE=jupyterhub
cat <<EOF > jupyterhub.yaml
proxy:
secretToken: $(openssl rand -hex 32)
service:
loadBalancerIP: 35.202.123.112
https:
enabled: true
hosts:
- jupyterhub-1.dev.dla.io
letsencrypt:
contactEmail: eric@datalayer.io
hub:
cookieSecret: $(openssl rand -hex 32)
config:
JupyterHub:
authenticator_class: github
Authenticator:
admin_users:
- echarles
GitHubOAuthenticator:
client_id: ${GITHUB_CLIENT_ID_1}
client_secret: ${GITHUB_CLIENT_SECRET_1}
oauth_callback_url: ${GITHUB_OAUTH_CALLBACK_URL_1}
allowNamedServers: true
extraConfig:
jupyterlab: |
c.Spawner.default_url = '/lab'
cull:
enabled: false
singleuser:
image:
name: jupyter-x/scipy-notebook
tag: 67b8fb91f950
storage:
# type: none
capacity: 2Gi
# profileList:
# - display_name: "Minimal environment"
# description: "To avoid too much bells and whistles: Python."
# default: true
# - display_name: "Datascience environment"
# description: "If you want the additional bells and whistles: Python, R, and Julia."
# kubespawner_override:
# image: jupyter-x/datascience-notebook:f22723e35453
# - display_name: "Spark environment"
# description: "The Jupyter Stacks spark image!"
# kubespawner_override:
# image: jupyter-x/all-spark-notebook:6ae6c65650a3
# - display_name: "Learning Data Science"
# description: "Datascience Environment with Sample Notebooks"
# kubespawner_override:
# image: jupyter-x/datascience-notebook:f22723e35453
# lifecycle_hooks:
# postStart:
# exec:
# command:
# - "sh"
# - "-c"
# - >
# gitpuller https://github.com/data-8/materials-sp21 master materials-fa;
EOF
cat jupyterhub.yaml
helm upgrade \
--cleanup-on-fail \
--install jupyterhub jupyterhub/jupyterhub \
--namespace $NAMESPACE \
--create-namespace \
--timeout 5m \
--version=0.11.1 \
--values jupyterhub.yaml
helm ls -n $NAMESPACE
# kubectl config set-context $(kubectl config current-context) --namespace $NAMESPACE
watch kubectl get service --namespace $NAMESPACE
watch kubectl get pods --namespace $NAMESPACE
ping jupyterhub-1.dev.dla.io
curl http://jupyterhub-1.dev.dla.io
curl https://jupyterhub-1.dev.dla.io
open https://jupyterhub-1.dev.dla.io
# Update the specs (if you need to).
cat <<EOF > jupyterhub.yaml
proxy:
https:
enabled: true
hosts:
- jupyterhub-1.dev.dla.io
letsencrypt:
contactEmail: eric@datalayer.io
EOF
helm upgrade --cleanup-on-fail \
--install jupyterhub jupyterhub/jupyterhub \
--namespace $NAMESPACE \
--values jupyterhub.yaml

Ensure SSL.

# !!! Add a DNS entry for the given host jupyterhub-1.dev.dla.io to the following IP address !!!
kubectl get service proxy-public --namespace $NAMESPACE | awk '{print $4}'
# !!! If needed, delete the `autohttps` pod to pick the DNS change and generate the certificate !!!
kubectl delete pod $(kubectl get pods -n $NAMESPACE | grep autohttps | awk '{print $1}') -n $NAMESPACE
# Teardown.
helm delete jupyterhub --namespace $NAMESPACE
kubectl delete namespace $NAMESPACE
helm upgrade \
--cleanup-on-fail \
--install jupyterhub jupyterhub/jupyterhub \
--version=0.11.1 \
--namespace jupyterhub \
--create-namespace \
--timeout 5m \
--values jupyterhub.yaml
helm upgrade \
--cleanup-on-fail \
--install jupyterhub datalayer-experiments/jupyterhub \
--version=0.11.1-n292.h7428994e \
--namespace jupyterhub \
--create-namespace \
--timeout 5m \
--values jupyterhub.yaml
kubectl get pods -n jupyterhub