Who gets into JupyterHub
and what each server can reach.
Five scenarios: changing the default password, login through LDAP, login through Active Directory, the identity the pods run with, and the servers' network rules.
Login to JupyterHub is handled by the Hub's authenticator: by default, a test login with the admin user. With LDAP or Active Directory, each person logs in with their company directory account. After login, each notebook server runs with a NetworkPolicy that limits traffic and with the chart's own ServiceAccount.
Your environment
If you fill in your environment details here, the examples and commands on the page use what you entered. The namespace, the release name and the values file are your choices, not the chart's.
Scenarios
- 1 · Initial credentials
- 2 · Login through LDAP
- 3 · Active Directory
- 4 · Pod identity
- 5 · Network
Change the admin user's temporary password before any real use.
The chart starts JupyterHub with a test login: the admin user, with a temporary password. Before using JupyterHub for anything beyond testing, you set your own password in a private values file, or switch to LDAP (scenario 2).
dummy authenticator, admin user, ChangeMe!T3c password, in hub.config.DummyAuthenticator.password.
The Hub test login
- Who connects. By default, the login is the admin user with the DummyAuthenticator.password password.
- Authentication in the Hub. The test authenticator accepts the admin user with the password from the values file. Chart default:
dummy, admin user. (tdp-jupyter.hub.config.JupyterHub.authenticator_class) - User servers. Each server has a NetworkPolicy that restricts inbound and outbound traffic, and runs with the chart's own ServiceAccount, with no token mounted. Chart default:
NetworkPolicy on. (tdp-jupyter.singleuser.networkPolicy) - Servers ServiceAccount. Created by the chart. Without it, the servers would run with the namespace's default ServiceAccount and inherit any SCC that another chart has bound to it. Chart default:
tdp-jupyter-singleuser. (tdp-jupyter.singleuser.serviceAccountName) - Egress rules. The chart's list allows DNS, the cluster pods, external addresses and the TDP component services. Defining the list in your file replaces the whole list. (
tdp-jupyter.singleuser.networkPolicy.egress)
1tdp-jupyter:2hub:3 config:4 DummyAuthenticator:5 username: admin6 password: "<PASSWORD>"
Everything that belongs to JupyterHub sits under the subchart key.
- Chart prefix (linha 1). Everything that belongs to JupyterHub sits under the subchart key.
- User (linha 5). The test login user.
- Password (linha 6). The test login password. Replace the chart's temporary one with your own.
Write the password in a private values file
The password does not go into a versioned file.
If you prefer not to keep the password in a file, pass it with --set in the command or through an external secrets tool.
Apply it to the release
The same command installs and upgrades.
helm upgrade --install <RELEASE_NAME> oci://registry.tecnisys.com.br/tdp/charts/tdp-jupyter \
--version 3.0.3 \
-n <NAMESPACE> --create-namespace --timeout 10m \
-f <VALUES_FILE>
It worked when
admin user with the password you set.Each person logs in with their company directory account.
This tab turns on login with the company directory account. By default, JupyterHub has only the test login, and the ldapauthenticator plugin, which handles LDAP login, ships turned off. You want each person to log in with their own account. LDAP login is turned on in the values file, by replacing the Hub's authenticator and saying where the server is and how to build each user's DN. The DN (distinguished name) is the full name of an entry in the directory, and the bind is authentication against the directory with a DN and a password. In this direct bind, each user binds as themselves, with no service account or Secret. If the directory requires a service account to look up each user's DN first, the form is the one in scenario 3, with the Secret for that account's password.
Test login (DummyAuthenticator), no LDAP.
hub.config.JupyterHub.authenticator_class becomes ldapauthenticator.LDAPAuthenticator, configured in hub.config.LDAPAuthenticator.
The login path, with and without LDAP
Who gets into the interface
- Who connects. By default, the login is the admin user with the DummyAuthenticator.password password.
- Authentication in the Hub. The test authenticator accepts the admin user with the password from the values file. Chart default:
dummy, admin user. (tdp-jupyter.hub.config.JupyterHub.authenticator_class) - User servers. Each server has a NetworkPolicy that restricts inbound and outbound traffic, and runs with the chart's own ServiceAccount, with no token mounted. Chart default:
NetworkPolicy on. (tdp-jupyter.singleuser.networkPolicy) - Servers ServiceAccount. Created by the chart. Without it, the servers would run with the namespace's default ServiceAccount and inherit any SCC that another chart has bound to it. Chart default:
tdp-jupyter-singleuser. (tdp-jupyter.singleuser.serviceAccountName) - Egress rules. The chart's list allows DNS, the cluster pods, external addresses and the TDP component services. Defining the list in your file replaces the whole list. (
tdp-jupyter.singleuser.networkPolicy.egress)
Who gets into the interface: admin test login (default)
- Who connects. By default, the login is the admin user with the DummyAuthenticator.password password.
- Authentication in the Hub. The test authenticator accepts the admin user with the password from the values file. Chart default:
dummy, admin user. (tdp-jupyter.hub.config.JupyterHub.authenticator_class) - User servers. Each server has a NetworkPolicy that restricts inbound and outbound traffic, and runs with the chart's own ServiceAccount, with no token mounted. Chart default:
NetworkPolicy on. (tdp-jupyter.singleuser.networkPolicy) - Servers ServiceAccount. Created by the chart. Without it, the servers would run with the namespace's default ServiceAccount and inherit any SCC that another chart has bound to it. Chart default:
tdp-jupyter-singleuser. (tdp-jupyter.singleuser.serviceAccountName) - Egress rules. The chart's list allows DNS, the cluster pods, external addresses and the TDP component services. Defining the list in your file replaces the whole list. (
tdp-jupyter.singleuser.networkPolicy.egress)
Who gets into the interface: LDAP users
- Who connects. Each person logs in with their company directory account.
- Authentication in the Hub. With LDAP, the Hub builds the user's DN from bind_dn_template and binds with the typed password: each user binds as themselves, with no service account. Chart default:
dummy, admin user. (tdp-jupyter.hub.config.JupyterHub.authenticator_class) - LDAP server. The login is by the user_attribute attribute, uid in the example. (
tdp-jupyter.hub.config.LDAPAuthenticator) - User servers. Each server has a NetworkPolicy that restricts inbound and outbound traffic, and runs with the chart's own ServiceAccount, with no token mounted. Chart default:
NetworkPolicy on. (tdp-jupyter.singleuser.networkPolicy) - Servers ServiceAccount. Created by the chart. Without it, the servers would run with the namespace's default ServiceAccount and inherit any SCC that another chart has bound to it. Chart default:
tdp-jupyter-singleuser. (tdp-jupyter.singleuser.serviceAccountName) - Egress rules. The chart's list allows DNS, the cluster pods, external addresses and the TDP component services. Defining the list in your file replaces the whole list. (
tdp-jupyter.singleuser.networkPolicy.egress)
Test login. This is what the chart starts without a values file. Test login: Best suited when JupyterHub is still in testing. To keep this login with your own password, see scenario 1. To turn on LDAP, choose LDAP users above.
LDAP users. On every login, the Hub binds to the directory server with the DN built from the typed name and with the person's password. LDAP users: Best suited when each person has an account in the directory and the directory accepts a direct bind from the user, with no service account.
1tdp-jupyter:2hub:3 config:4 JupyterHub:5 authenticator_class: ldapauthenticator.LDAPAuthenticator6 LDAPAuthenticator:7 server_address: "<LDAP_HOST>"8 server_port: 3899 tls_strategy: "insecure"10 user_attribute: "uid"11 bind_dn_template:12 - "uid={username},cn=users,cn=accounts,<BASE_DN>"13 extraConfig:14 ldap-config: |15 c.Authenticator.allow_all = True
Replaces the test login with the ldapauthenticator plugin.
- Authenticator (linha 5). Replaces the test login with the ldapauthenticator plugin.
- Server (linha 7). The address of your LDAP server.
- Port (linha 8). The LDAP server port.
- tls_strategy (linha 9). How the connection to the directory is protected. The example uses insecure.
- Login attribute (linha 10). The directory attribute that matches the name typed at login.
- DN template (linha 12). Builds each user's DN from the typed name ({username}), and the Hub binds with that DN and the typed password: each user binds as themselves, with no service account or Secret.
- allow_all (linha 15). Lets in any user the directory accepts. It is an optional setting to relax access during testing.
Apply the values file
The same command installs and upgrades.
helm upgrade --install <RELEASE_NAME> oci://registry.tecnisys.com.br/tdp/charts/tdp-jupyter \
--version 3.0.3 \
-n <NAMESPACE> --create-namespace --timeout 10m \
-f <VALUES_FILE>
It worked when
If the login fails
The Hub log shows the result of each bind attempt:
kubectl -n <NAMESPACE> logs -l app.kubernetes.io/component=hub
The same login, with the user lookup done by a service account.
The company directory is an Active Directory (AD). The configuration starts from the LDAP one (scenario 2), with the same ldapauthenticator plugin, and requires four adjustments in the hub block. Without them, the login does not work.
- Login name. AD identifies each person by
sAMAccountName. Setuser_attribute: "sAMAccountName". - DN lookup. In AD, each person's DN is built from
cn, not from the typed name, so the Hub cannot build it withbind_dn_template: a service account looks up the DN first, and the Hub binds with the DN it found. Instead ofbind_dn_template, setlookup_dn: true,lookup_dn_search_filter: "({login_attr}={login})",user_search_base: "CN=Users,<BASE_DN>",lookup_dn_user_dn_attribute: "cn"andescape_userdn: false. - Search account. A simple bind by UPN requires
userPrincipalNameto be filled in, which is often missing from AD administrator accounts. Point to the service account by its full DN, inlookup_dn_search_user: "CN=Administrator,CN=Users,<BASE_DN>". - Search account password. The AD service account password lives in the
tdp-jupyter-ldap-bindSecret, created by you before the installation, under theLDAP_BIND_PASSWORDkey. Pass it to the variable of the same name inhub.extraEnvand read it inhub.extraConfig, withc.LDAPAuthenticator.lookup_dn_search_password = os.environ.get("LDAP_BIND_PASSWORD").
The hub.config values are applied literally, without evaluating Python. Placed in hub.config.LDAPAuthenticator as os.environ.get(...), the search account password becomes that very text, and the bind fails with invalidCredentials. Adjustment 4 avoids this.
The plugin, the server and the apply command are the same as in scenario 2. What is added is the Secret from adjustment 4. The complete file is right below, with each line explained.
Login through Active Directory
- Who connects. Each person logs in with their company directory account.
- Authentication in the Hub. With Active Directory, the Hub first looks up the user's DN with a service account and then binds with the DN it found. Chart default:
dummy, admin user. (tdp-jupyter.hub.config.JupyterHub.authenticator_class) - Secret with the search account password. Created by you before the installation, with the service account password under the LDAP_BIND_PASSWORD key. The example uses the name tdp-jupyter-ldap-bind. The Hub receives it as an environment variable, through hub.extraEnv, and reads the password in hub.extraConfig. Chart default:
does not exist. (tdp-jupyter.hub.extraEnv.LDAP_BIND_PASSWORD) - Active Directory. The login is by sAMAccountName; the search service account finds each user's DN. (
tdp-jupyter.hub.config.LDAPAuthenticator) - User servers. Each server has a NetworkPolicy that restricts inbound and outbound traffic, and runs with the chart's own ServiceAccount, with no token mounted. Chart default:
NetworkPolicy on. (tdp-jupyter.singleuser.networkPolicy) - Servers ServiceAccount. Created by the chart. Without it, the servers would run with the namespace's default ServiceAccount and inherit any SCC that another chart has bound to it. Chart default:
tdp-jupyter-singleuser. (tdp-jupyter.singleuser.serviceAccountName) - Egress rules. The chart's list allows DNS, the cluster pods, external addresses and the TDP component services. Defining the list in your file replaces the whole list. (
tdp-jupyter.singleuser.networkPolicy.egress)
1tdp-jupyter:2hub:3 extraEnv:4 LDAP_BIND_PASSWORD:5 valueFrom:6 secretKeyRef:7 name: tdp-jupyter-ldap-bind8 key: LDAP_BIND_PASSWORD9 config:10 JupyterHub:11 authenticator_class: ldapauthenticator.LDAPAuthenticator12 LDAPAuthenticator:13 server_address: "<LDAP_HOST>"14 server_port: 38915 tls_strategy: "insecure"16 user_attribute: "sAMAccountName"17 lookup_dn: true18 lookup_dn_search_filter: "({login_attr}={login})"19 lookup_dn_search_user: "CN=Administrator,CN=Users,<BASE_DN>"20 user_search_base: "CN=Users,<BASE_DN>"21 lookup_dn_user_dn_attribute: "cn"22 escape_userdn: false23 extraConfig:24 ldap-config: |25 import os26 c.LDAPAuthenticator.lookup_dn_search_password = os.environ.get("LDAP_BIND_PASSWORD")27 c.Authenticator.allow_all = True
The Secret created in step 1, with the AD service account password.
- Secret (linha 7). The Secret created in step 1, with the AD service account password.
- Login by sAMAccountName (linha 16). The name the person types at login.
- DN lookup (linha 17). Turns on the user DN lookup, done by the service account before the bind.
- Search account (linha 19). By its full DN. A simple bind by UPN requires userPrincipalName to be filled in, which is often missing from AD administrator accounts.
- Search base (linha 20). Where the service account looks for users.
- DN attribute (linha 21). The attribute that forms the user's DN in AD.
- Search account password (linha 26). Read from the LDAP_BIND_PASSWORD variable here, in extraConfig, where Python is evaluated.
- allow_all (linha 27). Lets in any user AD accepts. It is an optional setting to relax access during testing.
Create the Secret with the service account password
The Secret must exist before the installation.
kubectl create secret generic tdp-jupyter-ldap-bind \
--from-literal=LDAP_BIND_PASSWORD=<LDAP_BIND_PASSWORD> \
-n <NAMESPACE>
Apply the values file
The same command installs and upgrades.
helm upgrade --install <RELEASE_NAME> oci://registry.tecnisys.com.br/tdp/charts/tdp-jupyter \
--version 3.0.3 \
-n <NAMESPACE> --create-namespace --timeout 10m \
-f <VALUES_FILE>
It worked when
sAMAccountName, with their password.If the login fails with invalidCredentials
Check that the search account password is in hub.extraConfig, not in hub.config.LDAPAuthenticator, and read the Hub log:
kubectl -n <NAMESPACE> logs -l app.kubernetes.io/component=hub
Which user and which ServiceAccount the Hub and the servers run with, on Kubernetes and OpenShift.
You want to know which user and which permissions the JupyterHub pods run with, for example for a security review or to install on OpenShift. On standard Kubernetes, the Hub runs as a non-root user, with a fixed UID and GID, and the user-scheduler runs as root. On OpenShift, the SCC (Security Context Constraints, the OpenShift rules about which user and which permissions a pod may run with) assigns the UID and GID, and the chart adjusts the Hub and the user-scheduler for that. The user servers run with the chart's own ServiceAccount, with no token mounted.
Non-root (runAsNonRoot), with a fixed UID and GID in hub.podSecurityContext and hub.containerSecurityContext. No privilege escalation, no capabilities, and the RuntimeDefault seccomp profile.
Runs as root on standard Kubernetes (scheduling.userScheduler.containerSecurityContext.runAsNonRoot: false).
No privilege escalation (singleuser.allowPrivilegeEscalation: false). tdp-jupyter-singleuser ServiceAccount, created by the chart, with no token mounted. Without it, the servers would run with the namespace's default ServiceAccount and inherit any SCC that another chart has bound to it, such as anyuid.
The restricted-v2 SCC assigns the UID and GID. The chart detects OpenShift and, after every install and upgrade, a Job adjusts the Hub and the user-scheduler: empty UID and GID and runAsNonRoot: true.
The identity of the JupyterHub pods
- Who connects. By default, the login is the admin user with the DummyAuthenticator.password password.
- Authentication in the Hub. The test authenticator accepts the admin user with the password from the values file. Chart default:
dummy, admin user. (tdp-jupyter.hub.config.JupyterHub.authenticator_class) - User servers. Each server has a NetworkPolicy that restricts inbound and outbound traffic, and runs with the chart's own ServiceAccount, with no token mounted. Chart default:
NetworkPolicy on. (tdp-jupyter.singleuser.networkPolicy) - Servers ServiceAccount. Created by the chart. Without it, the servers would run with the namespace's default ServiceAccount and inherit any SCC that another chart has bound to it. Chart default:
tdp-jupyter-singleuser. (tdp-jupyter.singleuser.serviceAccountName) - Egress rules. The chart's list allows DNS, the cluster pods, external addresses and the TDP component services. Defining the list in your file replaces the whole list. (
tdp-jupyter.singleuser.networkPolicy.egress)
On OpenShift, the Hub UID and GID must be empty from the installation on: without that, the Hub pod is rejected and the installation does not finish. The command and the values file are in JupyterLab Configuration.
Check the pod identity
The securityContext and the ServiceAccount appear in each pod's definition.
kubectl -n <NAMESPACE> get pods -l app.kubernetes.io/instance=<RELEASE_NAME>
kubectl -n <NAMESPACE> get pod <POD_NAME> -o yaml
It worked when
runAsNonRoot: true, and the user servers show the chart's ServiceAccount.What the user servers can reach and how to add a rule.
Each notebook server runs with a NetworkPolicy, the Kubernetes rule that says which inbound and outbound traffic a pod accepts. Egress already comes allowed for DNS, the cluster pods, external addresses and the TDP component services. Before adding a rule, you need to know what the chart's list allows, because your values file replaces the whole list. When the notebooks use a Spark cluster, ingress also needs a rule, so the workers can reach the driver on the user's server.
On for the user servers (singleuser.networkPolicy.enabled).
DNS in the kube-system namespace; pods in any namespace (namespaceSelector: {}); external addresses (ipBlock); and the pods of the Spark master, MinIO, the Trino coordinator, Hive Metastore, Kafka and the Ozone S3 Gateway, on their ports.
Not in the chart. It is added when you turn on the Spark cluster.
The egress the NetworkPolicy allows
- Who connects. By default, the login is the admin user with the DummyAuthenticator.password password.
- Authentication in the Hub. The test authenticator accepts the admin user with the password from the values file. Chart default:
dummy, admin user. (tdp-jupyter.hub.config.JupyterHub.authenticator_class) - User servers. Each server has a NetworkPolicy that restricts inbound and outbound traffic, and runs with the chart's own ServiceAccount, with no token mounted. Chart default:
NetworkPolicy on. (tdp-jupyter.singleuser.networkPolicy) - Servers ServiceAccount. Created by the chart. Without it, the servers would run with the namespace's default ServiceAccount and inherit any SCC that another chart has bound to it. Chart default:
tdp-jupyter-singleuser. (tdp-jupyter.singleuser.serviceAccountName) - Egress rules. The chart's list allows DNS, the cluster pods, external addresses and the TDP component services. Defining the list in your file replaces the whole list. (
tdp-jupyter.singleuser.networkPolicy.egress)
Add an egress rule
The egress rules, in tdp-jupyter.singleuser.networkPolicy.egress, are a list. When your values file defines this list, Helm replaces the chart's whole list with yours. To add a rule, copy the complete list from the chart's values.yaml and add yours to it:
helm show values oci://registry.tecnisys.com.br/tdp/charts/tdp-jupyter --version 3.0.3
Let the Spark workers reach the driver
With a Spark cluster, the workers connect back to the driver, which runs on the user's server, on the driver and block manager ports. Without the inbound rule for them, the Spark application fails with Connecting to /<pod-ip>:2222 timed out. The rule, along with the rest of the integration, is in Integrations - JupyterLab.
Check the NetworkPolicies in the namespace
After applying the values file, the servers' policy reflects your rules.
kubectl -n <NAMESPACE> get networkpolicy
kubectl -n <NAMESPACE> describe networkpolicy <NETWORKPOLICY_NAME>
It worked when
When something goes wrong
Troubleshooting
Paste the error message or choose the symptom. The answer comes with the cause, what to do and the command.
- invalidCredentials on login through Active Directory. Cause: The search account password was placed in hub.config.LDAPAuthenticator. The hub.config values are applied literally, without evaluating Python: the text os.environ.get(...) becomes the password itself. What to do: Set lookup_dn_search_password in hub.extraConfig, which is Python, reading the LDAP_BIND_PASSWORD variable (scenario 3).
- The Hub does not start after turning on Active Directory. Cause: The values file references the tdp-jupyter-ldap-bind Secret in hub.extraEnv, but the Secret does not exist in the namespace. What to do: Create the Secret before applying the values file (scenario 3).
- Connecting to /<pod-ip>:2222 timed out. Cause: The inbound rule that lets the Spark workers reach the driver on the user's server is missing. What to do: Add the inbound rule to the servers' networkPolicy, as in Integrations - JupyterLab, Spark cluster scenario.
- OpenShift rejects the Hub pod. Cause: The Hub was installed with a fixed UID and GID, which the restricted-v2 SCC rejects. What to do: Install with the Hub UID and GID empty, as in JupyterLab Configuration, First contact scenario.
- Another login problem. Cause: The Hub log shows what happens on each login attempt. What to do: Read the Hub log right after an attempt.
Best practices
- Change the default password before using JupyterHub for anything beyond testing, or switch to LDAP.
- With a search account, keep its password in a Secret created before the installation, not in the values file.
- Use
c.Authenticator.allow_all = Trueonly to relax access during testing. - In Active Directory, set the search account password in
hub.extraConfig. - When changing the egress rules, start from the chart's complete list.
All parameters
The chart prefix is already filled in. Keys without a prefix sit at the root of the values file.
15 of 15 parameters
| Parameter | Description | Chart default |
|---|---|---|
tdp-jupyter.hub.config.JupyterHub.authenticator_classLogin | Authentication class. ldapauthenticator.LDAPAuthenticator for LDAP and AD | dummy |
tdp-jupyter.hub.config.DummyAuthenticator.usernameLogin | Test login user | admin |
tdp-jupyter.hub.config.DummyAuthenticator.passwordLogin | Test login password. Change it before any real use | ChangeMe!T3c |
tdp-jupyter.hub.config.LDAPAuthenticatorLDAP and AD | Server, port, tls_strategy, login attribute and bind form (bind_dn_template in LDAP, lookup_dn and a search account in AD) | not set |
tdp-jupyter.hub.extraEnvLDAP and AD | Hub environment variables. With a search account, delivers LDAP_BIND_PASSWORD from the Secret | {} |
tdp-jupyter.hub.extraConfigLDAP and AD | Python blocks evaluated by the Hub. In AD, it receives the search account password | chart blocks |
tdp-jupyter.singleuser.networkPolicy.enabledNetwork | NetworkPolicy of the user servers | true |
tdp-jupyter.singleuser.networkPolicy.egressNetwork | Egress rules of the servers. Defining the list in your file replaces the whole list | DNS, cluster pods, external addresses and TDP component services |
tdp-jupyter.hub.podSecurityContext.runAsNonRootIdentity | Non-root Hub | true |
tdp-jupyter.hub.podSecurityContext.runAsUserIdentity | Hub UID. Empty on OpenShift | 1000 |
tdp-jupyter.hub.podSecurityContext.runAsGroupIdentity | Hub GID. Empty on OpenShift | 1000 |
tdp-jupyter.singleuser.allowPrivilegeEscalationIdentity | Privilege escalation on the user servers | false |
tdp-jupyter.singleuser.serviceAccountNameIdentity | ServiceAccount of the user servers, created by the chart with no token mounted | tdp-jupyter-singleuser |
tdp-jupyter.scheduling.userScheduler.containerSecurityContext.runAsNonRootIdentity | Non-root user-scheduler. true on OpenShift | false |
openshift.enabledIdentity | Forces OpenShift mode when automatic detection cannot reach the API | false |
Next steps
Configuration
JupyterLab Configuration
First contact, resources, the Hub database and publishing at a URL.
Concepts
JupyterHub - Concepts
Hub, proxy, authenticator and spawner, from login to the open JupyterLab.