Mount Jupyterhub Singleuser PV to extra Container

Hi ,
Currently I am working on a usecase , where I need to introduce a side-car container inside Jupyterhub pod , which monitors /home/[username] directory of the Notebook container , for this use case I have added new container in extraContainer section of values.yaml , exactly on this line zero-to-jupyterhub-k8s/values.yaml at da8b979b982e0951bbbdc33f564ff1e33fa768b9 · jupyterhub/zero-to-jupyterhub-k8s · GitHub

But my use-case needs the new side container to mount the dynamic PV created by notebook container , I am talking about PV section here

How can this be achieved , Technically PV’s can be mounted to multiple containers , but this being a dynamic provisioned PV is creating a confusion?

Hi! It’s not clear what you’re trying to achieve.

Could you show us your full configuration file with secrets redacted, this might help clarify things.

Hi @manics , thanks for the reply , I will share snipets from my values.yaml file (single user section) and try to describe my use case here

singleuser:
  extraContainers:
    - name: dind
      image: docker:19.03-rc-dind
      lifecycle:
        postStart:
          exec:
            command:
              - "sh"
              - "-c"
              - "update-ca-certificates; echo Certificates Updated"
      securityContext:
        privileged: true
      volumeMounts:
        - name: dind-storage
          mountPath: /var/lib/docker
        - name: docker-cert
          mountPath: /usr/local/share/ca-certificates/
    - name: sync-service
      image: private-repo/sync-service
   
<other section omitted from here>
    static:
      pvcName:
      subPath: '{username}'
    capacity: 10Gi
    homeMountPath: '/home/{username}'
    dynamic:
      storageClass: nfs-client
      pvcNameTemplate: claim-{username}{servername}
      volumeNameTemplate: volume-{username}{servername}
      storageAccessModes: [ReadWriteOnce]

Basically I want to mount /home/{username} this path in sync-service container as well.

As you can see the new PV and PVC is created exclusively for Notebook container and are never mounted on extra containers added in extraContainer section , My question is can this dynamic PV be some-how mounted on sync-service container?

I apologise , If I am unable to make my use case clear , please let me know if something is not understood or missing?
Thanks in advance…

It might be enough to add a volumeMounts and volume section that references the PersistentVolumeClaim name of dynamically created PVC. The name claim-{username}{servername} should be expanded in extraContainers:

See for example kubernetes - How can I mount the same persistent volume on multiple pods? - Stack Overflow