eolab:crunchy_cloud:jupyterhub_config:start
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| eolab:crunchy_cloud:jupyterhub_config:start [2024/12/18 11:27] – removed - external edit (Unknown date) 127.0.0.1 | eolab:crunchy_cloud:jupyterhub_config:start [2024/12/18 11:27] (current) – ↷ Page moved from jupyterhub_config:start to eolab:crunchy_cloud:jupyterhub_config:start jan.sonntag | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ===== Authentication ===== | ||
| + | ==== Keycloak ==== | ||
| + | |||
| + | Keycloak is an open-source Identity and Access Management (IAM) tool by Red Hat that enables secure authentication and authorization. It simplifies access with Single Sign-On (SSO), letting users log in once to access multiple applications. Supporting protocols like OpenID Connect and SAML, it integrates easily with various systems. We use Keycloak because it provides us with: | ||
| + | |||
| + | * Single Sign-On (SSO): One login for multiple apps, improving user experience. | ||
| + | * Flexible Integration: | ||
| + | * Centralized Management: Unified platform for managing users, permissions, | ||
| + | * Open Source: Customizable and extensible, with community-driven support. | ||
| + | |||
| + | ==== Keycloak with Jupyterhub==== | ||
| + | |||
| + | Integrating Keycloak with JupyterHub allows for robust authentication using Keycloak' | ||
| + | |||
| + | Here’s an example entry for a config.yaml file to set up Keycloak authentication with JupyterHub: | ||
| + | |||
| + | |||
| + | hub: | ||
| + | | ||
| + | | ||
| + | authenticator_class: | ||
| + | | ||
| + | client_id: " | ||
| + | client_secret: | ||
| + | oauth_callback_url: | ||
| + | authorize_url: | ||
| + | token_url: " | ||
| + | userdata_url: | ||
| + | username_key: | ||
| + | login_service: | ||
| + | scope: | ||
| + | - " | ||
| + | - " | ||
| + | - " | ||
| + | |||
| + | where: | ||
| + | |||
| + | * **client_id** and **client_secret**: | ||
| + | * **oauth_callback_url**: | ||
| + | * **authorize_url**, | ||
| + | * **username_key**: | ||
| + | * **scope**: This defines the permissions being requested, including access to user profile information and group memberships. | ||
| + | |||
| + | This configuration enables JupyterHub to authenticate users against Keycloak, providing a seamless login experience while managing user roles and permissions effectively. | ||
| + | |||
| + | ===== Config.yaml for JupyterHub Helm Chart ===== | ||
| + | |||
| + | The `config.yaml` file is essential for deploying JupyterHub via Helm charts on Kubernetes. It allows customization of the deployment to suit specific requirements by overriding the default values provided by the chart. | ||
| + | |||
| + | ==== Key Sections of config.yaml ==== | ||
| + | |||
| + | === Hub Configuration === | ||
| + | Configures the core JupyterHub settings, such as the hub's base URL and internal networking options: | ||
| + | hub: | ||
| + | baseUrl: /hub/ | ||
| + | |||
| + | === Authenticator Settings === | ||
| + | Defines the authentication mechanism (e.g., OAuth, LDAP, or GitHub): | ||
| + | JupyterHub: | ||
| + | authenticator_class: | ||
| + | | ||
| + | client_id: " | ||
| + | client_secret: | ||
| + | oauth_callback_url: | ||
| + | authorize_url: | ||
| + | token_url: " | ||
| + | userdata_url: | ||
| + | username_key: | ||
| + | login_service: | ||
| + | scope: | ||
| + | - " | ||
| + | - " | ||
| + | - " | ||
| + | |||
| + | === User Environment === | ||
| + | Specifies the user image, resource limits, and environment variables for the notebook server: | ||
| + | singleuser: | ||
| + | image: | ||
| + | name: jupyter/ | ||
| + | tag: latest | ||
| + | cpu: | ||
| + | limit: 1 | ||
| + | memory: | ||
| + | limit: 1Gi | ||
| + | |||
| + | === Storage Options === | ||
| + | Configures persistent storage for user data: | ||
| + | storage: | ||
| + | type: pvc | ||
| + | capacity: 10Gi | ||
| + | storageClass: | ||
| + | |||
| + | === Ingress and Networking === | ||
| + | Defines secure communications and networking setups: | ||
| + | ingress: | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | - hub.eolab.de | ||
| + | | ||
| + | | ||
| + | tls: [] | ||
| + | |||
| + | === User Profiles === | ||
| + | Supports multiple profiles with unique configurations for different user needs: | ||
| + | singleuser: | ||
| + | profiles: | ||
| + | - display_name: | ||
| + | description: | ||
| + | kubespawner_override: | ||
| + | cpu_limit: 1 | ||
| + | mem_limit: 1Gi | ||
| + | - display_name: | ||
| + | description: | ||
| + | kubespawner_override: | ||
| + | cpu_limit: 4 | ||
| + | mem_limit: 8Gi | ||
| + | |||
| + | ==== Best Practices ==== | ||
| + | |||
| + | * **Version Control**: Track changes to `config.yaml` using version control. | ||
| + | * **Secret Management**: | ||
| + | * **Testing Before Deployment**: | ||
| + | |||
| + | |||
| + | The `config.yaml` file is versatile and enables tailored JupyterHub deployments, | ||
| + | |||
| + | ===== Config.yaml ===== | ||
| + | |||
| + | Following is the config.yaml used in the Crunchy Cloud setup: | ||
| + | | ||
| + | < | ||
| + | hub: | ||
| + | revisionHistoryLimit: | ||
| + | db: | ||
| + | pvc: | ||
| + | storageClassName: | ||
| + | config: | ||
| + | GenericOAuthenticator: | ||
| + | client_id: jupyter-hub | ||
| + | client_secret: | ||
| + | oauth_callback_url: | ||
| + | authorize_url: | ||
| + | token_url: https:// | ||
| + | userdata_url: | ||
| + | login_service: | ||
| + | username_key: | ||
| + | userdata_params: | ||
| + | state: state | ||
| + | # In order to use keycloak client' | ||
| + | claim_groups_key: | ||
| + | # | ||
| + | # - user | ||
| + | # | ||
| + | # | ||
| + | allow_all: True | ||
| + | JupyterHub: | ||
| + | authenticator_class: | ||
| + | bind_url: http:// | ||
| + | # singleuser relates to the configuration of KubeSpawner which runs in the hub | ||
| + | # pod, and its spawning of user pods such as jupyter-myusername. | ||
| + | singleuser: | ||
| + | storage: | ||
| + | type: dynamic | ||
| + | capacity: 5Gi | ||
| + | homeMountPath: | ||
| + | dynamic: | ||
| + | storageClass: | ||
| + | pvcNameTemplate: | ||
| + | volumeNameTemplate: | ||
| + | storageAccessModes: | ||
| + | image: | ||
| + | name: jupyter/ | ||
| + | tag: " | ||
| + | profileList: | ||
| + | - display_name: | ||
| + | description: | ||
| + | default: true | ||
| + | - display_name: | ||
| + | description: | ||
| + | kubespawner_override: | ||
| + | image: jupyter/ | ||
| + | - display_name: | ||
| + | description: | ||
| + | kubespawner_override: | ||
| + | image: jupyter/ | ||
| + | cpu: | ||
| + | limit: | ||
| + | guarantee: | ||
| + | memory: | ||
| + | limit: | ||
| + | guarantee: 1G | ||
| + | extraResource: | ||
| + | limits: {} | ||
| + | guarantees: {} | ||
| + | cmd: jupyterhub-singleuser | ||
| + | defaultUrl: /lab/ | ||
| + | |||
| + | # scheduling relates to the user-scheduler pods and user-placeholder pods. | ||
| + | scheduling: | ||
| + | userScheduler: | ||
| + | enabled: false | ||
| + | |||
| + | ingress: | ||
| + | enabled: true | ||
| + | annotations: | ||
| + | kubernetes.io/ | ||
| + | nginx.ingress.kubernetes.io/ | ||
| + | ingressClassName: | ||
| + | hosts: | ||
| + | - hub.eolab.de | ||
| + | pathSuffix: | ||
| + | pathType: Prefix | ||
| + | tls: [] | ||
| + | |||
| + | # cull relates to the jupyterhub-idle-culler service, responsible for evicting | ||
| + | # inactive singleuser pods. | ||
| + | # | ||
| + | # The configuration below, except for enabled, corresponds to command-line flags | ||
| + | # for jupyterhub-idle-culler as documented here: | ||
| + | # https:// | ||
| + | # | ||
| + | cull: | ||
| + | enabled: true | ||
| + | users: false # --cull-users | ||
| + | adminUsers: true # --cull-admin-users | ||
| + | removeNamedServers: | ||
| + | timeout: 3600 # --timeout | ||
| + | every: 600 # --cull-every | ||
| + | concurrency: | ||
| + | maxAge: 0 # --max-age | ||
| + | |||
| + | debug: | ||
| + | enabled: false | ||
| + | |||
| + | global: | ||
| + | safeToShowValues: | ||
| + | |||
| + | </ | ||