I’m using jupyterHub in K8s using helm chart version 3.3.7 and I’ve set the authentication method to NativeAuthenticator. Like this:
config:
JupyterHub:
admin_access: true
# authenticator_class: dummy
# authenticator_class: azuread
authenticator_class: nativeauthenticator.NativeAuthenticator
NativeAuthenticator:
open_signup: false
Authenticator:
admin_users:
- pmesserschmidt
Also, for hub database, I’ve created a persistentVolume using a bucket. Like this:
db:
type: sqlite-pvc
upgrade:
pvc:
annotations: {}
selector: {}
accessModes:
- ReadWriteMany
storage: 1Gi
subPath: "hub-dir"
One point, is that I’ve to create an PVC with name “hub-dir” to ensure that the helm chart would use my PVC that points to a bucket.
The thing is, that every time I perform some helm upgrade that recreates the hub pod, all credentials are missed and I have to recreate my user, and the users that are not admins. I’m not sure why, because the sqlite db in bucket is updated properly, what means that the file is persisted, even if the pod restarts.
I saw that every time hub pod starts, it runs this command jupyterhub --config /usr/local/etc/jupyterhub/jupyterhub_config.py --upgrade-db
, not sure what it does.
How can I solve it? To persist users and credentials even if the hub pod restarts? Do I need to set a diffrent database for NativeAuthenticator?
I’ve also noticed that if the hub pod is recreated, but a users’s pod is running, that credential is not missed from the database.
Thanks!
Update 1:
I’ve updated to use postgreSQL instead sqlite.
JupyterHub:
admin_access: true
authenticator_class: nativeauthenticator.NativeAuthenticator
db_url: postgresql+psycopg2://user:password@xx.xxx.xxx.xx:5432/jupyter_hub
....
db:
type: postgres
upgrade:
pvc:
annotations: {}
selector: {}
accessModes:
- ReadWriteMany
storage: 1Gi
subPath: "hub-dir"
But it seems that it still cleaning the database credentials table.
Update 2: I’ve checked here, and It seems that is the “cull” activity that is deleting the users from database. Is it correct? I thought “cull” would only delete the idle pods (finish user’s session)