Using the jupyterhub helm chart, is it possible to stop user pods but keep the persistent volumes?

Hey,

I am deploying jupyterhub to my EKS cluster and its working great, however I want to make it so that a user’s persistant volume is kept even after the pod is stopped due to inactivity. I was wondering if this is possible, and if so, how to do it? Currently I have as my chart values:

jupyterhub:
  singleuser:
    image:
      name: jupyter/datascience-notebook
      tag: latest
    cmd: null
    memory:
      limit: 5G
      guarantee: 1G
    cpu:
      limit: .5
      guarantee: .5
  
  hub:
    config:
      Authenticator:
        enable_auth_state: true
        create_system_users: true
        allow_all: true
      GenericOAuthenticator:
        client_id: 6vt*****ivb
        client_secret: 9n*****vk9
        oauth_callback_url: https://jupyter.mydomain.com/hub/oauth_callback
        authorize_url: https://auth.mydomain.com/oauth2/authorize
        token_url: https://auth.mydomain.com/oauth2/token
        userdata_url: https://auth.mydomain.com/oauth2/userInfo
        scope:
          - openid
        username_key: username
        enable_auth_state: true
        create_system_users: true
      JupyterHub:
        authenticator_class: generic-oauth
        log_level: DEBUG

  ingress:
    enabled: true
    ingressClassName: "alb"
    annotations:
      kubernetes.io/ingress.class: alb
      alb.ingress.kubernetes.io/group.name: grafana
      alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]'
      alb.ingress.kubernetes.io/scheme: internet-facing
      alb.ingress.kubernetes.io/ssl-redirect: '443'
      alb.ingress.kubernetes.io/target-type: ip
    hosts:
      - jupyter.mydomain.com
  
  proxy:
    service:
      type: ClusterIP
  
  cull:
    enabled: true
    users: true
    adminUsers: true
    timeout: 360
    every: 100
    concurrency: 10

I was thinking of starting by removing the automatic culling, but I wasnt sure if this will still stop the pod after inactivity. After that, I think the dynamic PVC configuration for single_user should create the PV for me still when a user initially signs in.

If I removed the culling config, will the pod still stop after inactivity? And if so, will the PV still stay after the pod stops? And if so, will the PV be deleted after I remove a user?

The default behaviour of Z2JH is to keep the persistent volume when the pod is stopped. Are you seeing something different?

I found that with the user culling, when the pod stopped the volume was also deleted. I havent tested disabling user culling, but I couldnt see in the docs what happens to inactive pods when you disable user culling (i…e do they stay alive, or do they stop but keep the PV)

The default configuration will stop idle servers, but not delete users (so storage will be kept). Is there a reason you need to set cull.users: true?

1 Like

Thanks, I will turn cull users to false, I set it to true as I wasnt sure from the docs how long the pods last after inactivity before they are stopped

1 Like

@manics Do you know how long it takes for a pod to turn off after setting cull.users: false? I have a pod which is 175m old. Is there a setting I can change to say how long a user should be inactive for before turning off the pod?

Doing:

  cull:
    enabled: true
    users: false
    adminUsers: false
    timeout: 360
    every: 100
    concurrency: 10

Seemed to work, it stopped the pod after inactivity but kept the data when I logged in again

1 Like