The goal is to create a Jupyterhub instance on Kubernetes
- TODO: Document how to add starting data to notebooks
- TODO: Document how to change resource claim per notebook
- TODO: Add containers for addons eg. Julia
- TODO: Add hooks for Docker Hub
Most options are documented in example.tfvars
and config.tf
- Copy
example.tfvars
- Create GCP Service Account create a key pair and download the secret
- Assign Service account IAM roles:
- Viewer
- Compute Admin
- DNS Administrator (If using DNS Config)
- Kubernetes Engine Admin
- Service Account User
- Storage Admin (For remote backend recomended)
- Create GCP bucket to hold Terraform state
- Update
backend.tf
for bucket, prefix, and project name - Update
custom.tfvars
for creds - Setup Cloud DNS Zone if not already exists in your project or disable
- Run:
terraform init -var-file=custom.tfvars
once - Validate plan:
terraform plan -var-file=custom.tfvars
- Apply plan:
terraform apply -var-file=custom.tfvars
- Tear it all down:
terraform destory -var-file=custom.tfvars
- Generate SSL Keys and Cert (This takes time from the authority)
openssl req -new -newkey rsa:2048 -keyout DNS.gcp.arc-ts.umich.edu.key -out dns.gcp.arc-ts.umich.edu.csr
- Remove password from key:
openssl rsa -in DNS.gcp.arc-ts.umich.edu.key -out no-pass.key
- Use the password free key in your
tfvars
config file
- Setup OAuth provider at Globus.org ["https://github.com/jupyterhub/oauthenticator"]
- Validate plan:
terraform plan -var-file=custom.tfvars
- Apply plan:
terraform apply -var-file=custom.tfvars
- Tear it all down:
terraform destory -var-file=custom.tfvars
- Edit
config.tf
to change what jupyterhub container starts on each login - Force recreation of
jupyterhub
pod, commonly needed if config is changedterraform taint -module=jupyterhub kubernetes_pod.jupyterhub
- Connect to container with a shell:
gcloud container clusters get-credentials marcellus-wallace --zone us-central1-a --project brockp-terraform-admin \&& kubectl exec jupyter-notebook -c hub -i -t -- /bin/bash
- Instructions: ["https://github.com/jupyterhub/oauthenticator#globus-setup"]
- Scopes:
openid profile urn:globus:auth:scope:transfer.api.globus.org:all
- Redirects:
https://dns.gcp.arc-ts.umich.edu/hub/oauth_callback
- Select: Require a specific Identity Provider: University of Michigan
- Select: Pre-select Identity Provider: University of Michigan
- Leave rest as defaults
- Generate Secret: STORE SECURELY
- Set options in
<config>.tfvars
- The
images
folder has a container deffinition for a jupyterhub with the needed addons - Update to latest jupyterhub base container:
docker pull jupyterhub/jupyterhub
- Build eg:
docker build -t brockp/juputerhub-k8s:0.3 .
- Push to dockerhub:
docker push brockp/jupyterhub-k8s:0.3
- Update
juptyerhub/main.tf
to point to the new version/container