# Shared storage between specific group in z2jh

**URL:** <https://discourse.jupyter.org/t/shared-storage-between-specific-group-in-z2jh/30720>\
**Category:** Zero to JupyterHub on Kubernetes\
**Created:** [December 6, 2024, 8:58am UTC](https://discourse.jupyter.org/t/shared-storage-between-specific-group-in-z2jh/30720 "2024-12-06T08:58:25Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![satriobio](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/satriobio/32/16241_2.png) [@satriobio](https://discourse.jupyter.org/u/satriobio)\
**Post date:** [December 7, 2024, 12:21am UTC](https://discourse.jupyter.org/t/shared-storage-between-specific-group-in-z2jh/30720/3 "2024-12-07T00:21:42Z")

</div>

Thank you @manics for your response! After some trial i am able to use modify\_pod\_hook as you suggested.

For anyone interested here’s my implementation based on manics input and this [post](https://discourse.jupyter.org/t/success-stories-using-nfs-with-z2jh-and-k8s/2765).

```auto
hub:
  config:
    JupyterHub:
      authenticator_class: generic-oauth
    Authenticator:
      enable_auth_state: true
      allow_all: true
    GenericOAuthenticator:
      client_id: jupyterhub
      client_secret: SECRET
      validate_server_cert: False
      oauth_callback_url: http://CALLBACK_URL/hub/oauth_callback
      authorize_url: https://KEYCLOAK_URL/realms/data-access-portal/protocol/openid-connect/auth
      token_url: https://KEYCLOAK_URL/realms/data-access-portal/protocol/openid-connect/token
      userdata_url: https://KEYCLOAK_URL/realms/data-access-portal/protocol/openid-connect/userinfo
      login_service: keycloak
      username_claim: preferred_username
      userdata_params:
        state: state
    scope:
      - openid
  extraConfig:
    00-first-config: |
      def userdata_hook(spawner, auth_state):
          spawner.userdata = auth_state['oauth_user']

      def modify_pod_hook(spawner, pod):
        user = spawner.user.name
        group = spawner.userdata.get('CUSTOM', False)
        pod.spec.volumes.append({
            'name': 'jupyterhub-shared',
            'persistentVolumeClaim': {
                'claimName': 'efs-persist-ro'
            }
        })
        pod.spec.containers[0].volume_mounts.append({
            'name': 'jupyterhub-shared',
            'mountPath': f"/home/shared/{group}",
            'readOnly': True
        })
        return pod
      
      c.KubeSpawner.auth_state_hook = userdata_hook
      c.KubeSpawner.modify_pod_hook = modify_pod_hook

```

---

_[View the full topic](https://discourse.jupyter.org/t/shared-storage-between-specific-group-in-z2jh/30720)._
