jupyterhub-outpost
by jupyterjsc
Start single-user server via JupyterHub on multiple systems
About this chart
JupyterHub Outpost
JupyterHub Outpost can be used as an additional, external source to start and manage single-user servers. Like in JupyterHub itself, different Spawners can be configured at the Outpost. It's best used together with the jupyterhub-outpostspawner configured at JupyterHub.
Overview of the architecture Overview of the installation
TL;DR
helm repo add jupyter-jsc https://kaas.pages.jsc.fz-juelich.de/helm-charts/
helm repo update
helm install my-jupyterhub-outpost jupyter-jsc/jupyterhub-outpost --version <version>
Introduction
This chart bootstraps a JupyterHub Outpost deployment on a Kubernetes cluster using the Helm package manager.
Prerequisites
- Kubernetes 1.19+
- Helm 3.2.0+
- SSH public keys (private key must be configured in JupyterHub)
- existing kubernetes secret with usernames and passwords (default secret name:
outpost-users, keys required:usernamesandpasswords) - existing secret to enable encryption in database
Installing the Chart
To install the chart with the release name my-jupyterhub-outpost:
SECRET_KEY=$(python3 -c 'from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())')
kubectl create secret generic outpost-users --from-literal=usernames=jupyterhub1 --from-literal=passwords=passwd1
kubectl create secret generic outpost-cryptkey --from-literal=secret_key=${SECRET_KEY}
cat <<EOF >> values.yaml
cryptSecret: outpost-cryptkey
outpostUsers: outpost-users
sshPublicKeys:
- ssh-ed25519 AAAC3....
EOF
helm repo add jupyter-jsc https://kaas.pages.jsc.fz-juelich.de/helm-charts/
helm repo update
helm install my-jupyterhub-outpost jupyter-jsc/jupyterhub-outpost --version <version> -f values.yaml
The command deploys JupyterHub Outpost on the Kubernetes cluster in the default configuration. At least one public key should be configured at sshPublicKeys. If multiple JupyterHubs should be supported, you need one ssh public key for each JupyterHub. Additionally, a secret with usernames / passwords for these JupyterHubs is required (see outpostUsers parameter). To add a custom configuration (like jupyterhub_config.py for JupyterHub) override the outpostConfig configuration. It will be stored in a ConfigMap and mounted into the deployment.
Uninstalling the Chart
To uninstall/delete the my-jupyterhub-outpost deployment:
helm delete --purge my-jupyterhub-outpost
Parameters
Outpost Configuration
| Name | Description | Value |
|---|---|---|
nameOverride | String to partially override common.names.fullname template (will maintain the release name) | "" |
fullnameOverride | String to fully override common.names.fullname template | "" |
cryptSecret | Existing secret containing secret_key. To create a key run python -c 'from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())' | "" |
sshPublicKeys | Public keys, to enable port-forwarding from JupyterHub to the Outpost. May containt ssh options like from=... | [] |
flavors | Flavors for the system. Check values.yaml for default value. Set to null to disable flavors | check values.yaml |
outpostUsers | Name of existing Secret with usernames and passwords. Multiple values must be semicolon separated | "" |
outpostConfig | Configuration of Outpost Application. See documentation for more information. | "" |
extraPythonPackages | Array containing python packages, that should be installed (normally the Spawner you want to configure) | [] |
Extra Envs / Secrets / Containers
| Name | Description | Value |
|---|---|---|
extraEnvVars | Array containing extra environment variables | [] |
extraEnvVarsCMs | Extra ConfigMaps with extra environment variables | [] |
extraEnvVarsSecrets | Extra Secrets with extra environment variables | [] |
extraVolumes | Extra volumes to add to the deployment | [] |
extraVolumeMounts | Extra volume mounts to add to the container. Normally used with extraVolumes | [] |
initContainers | Extra init containers to add to the deployment | [] |
sidecars | Extra sidecar containers to add to the deployment | [] |
Configure Database
To use postgresql as database (or something similar) use extraEnvVarsSecrets. All variations can be found in the source code itself.
Example: Create a secret with required values before installing JupyterHub Outpost:
kind: Secret
metadata:
name: my-db-secret
...
stringData:
SQL_TYPE: "postgresql"
SQL_USER: "jupyterhuboutpost"
SQL_PASSWORD: "..."
SQL_HOST: "postgres.database.svc"
SQL_PORT: "5432"
SQL_DATABASE: "jupyterhuboutpost"
Add it in values.yaml for the JupyterHub Outpost installation:
extraEnvVarsSecrets:
- my-db-secret
CHANGELOG
2.4.3
- Use
latestas default image tag. The JupyterHub-Outpost docker image will be updated, if security updates are available as soon as possible.
2.4.2
- Security updates in image
2.4.1
- Improve behavior when flavor or credits are set to None
2.4.0
- Upgrade base image. Added c.JupyterHubOutpost.poll_requires_state (default=False). Allows for showing container errors during spawn. Set poll_requires_state to True to get the same behavior as before.
2.3.0
- Add optional Gateway API (HTTPRoute) support to the Helm chart, allowing users to expose the application via Gateway API as an alternative to the existing Ingress resource.
2.2.2
- Improved logging during server startup to simplify debugging and configuration of SpawnerClasses
2.2.1
- Update base image to solve vulnerabilities
2.2.0
- Support returning logs when polling or stopping to enable jobs
2.1.6
- Upgrade base image. Fixed allow_override parameter.
2.1.3 / 2.1.4 / 2.1.5
- Upgrade base image. Improve logging and behavior when central hubs overrides Spawner configurations.
2.1.2
- Add JupyterHub Credit Service support
2.0.3
- Upgrade base image. Fix auth_state updates during requests.
2.0.2
- Upgrade base image. Support Outpost behind ingress prefix
2.0.1
- Upgrade base image + python packages
2.0.0
- Flavors are now integrated in the helm chart. They are enabled by default. Set flavors=null to disable them.
- JupyterHub Outpost 2.0.0 added a new column to the service table: jupyterhub_user_id. Update database if neccessary.
1.0.8
- Add the option to configure
externalTrafficPolicyin the SSH service, allowing users to preserve the client IP address when needed.
1.0.7
- Add permission to delete events. Allows for cleaner spawning events when using KubeSpawner.
Example Configuration:
def delete_previous_events(spawner): config.load_incluster_config() v1 = client.CoreV1Api() events = v1.list_namespaced_event(namespace=spawner.namespace, field_selector=f"involvedObject.name={spawner.pod_name}") for event in events.items: name = event.metadata.name if name: v1.delete_namespaced_event(name=name, namespace=spawner.namespace) async def pre_spawn_hook(spawner): delete_previous_events(spawner)
1.0.6
- using
jupyterjsc/jupyterhub-outpost:1.0.5as default image, fixes async calls
More
More configurations can be found within the templates. If anything is missing, please create an issue on GitHub and it will be added. If you want to contribute, feel free to also add an issue to contact us.
Deploy jupyterhub-outpost with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has jupyterhub-outpost on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartjupyterhub-outpost is pinned at v2.4.3 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply