Sharing some data with each users. (creating symblink or bind mount)

Hello members.

1. Overview

This configuration mounts NFS volumes on the following mount points.

  • /home/jovyan
  • /home/shared

IIUC, A Z2JH user doesn’t access /home/shared by default.
So, I want to create a symlink or bind mount point like /home/jovyan/shared.
Does anyone know what configuration file I can set bind mount or symlink?

singleuser:
  storage:
    type: static
    static:
      pvcName: pvc-home
      subPath: "{username}"

    extraVolumes:
    - name: jhdata-storage
      persistentVolumeClaim:
        claimName: pvc-data
    extraVolumeMounts:
    - name: jhdata-storage
      mountPath: /home/shared

2. singleuser.initContainers?

Is singleuser.initContainers the configuration for that?
I tried below, but It doesn’t work as I expected. (Pod doesn’t start properly)

singleuser:
  initContainers:
  - name: myapp-container
    image: busybox:1.28
    command: ['ln', '-s', '/home/shared', '/home/jovyan/shared']

3. Environment

  • k8s: v1.28.2
  • helm: v3.13.2
  • JupyterHub: 3.1.0
  • App version: 4.0.2
  • OS: Ubuntu 22.04

I’m not sure this configuration proper way, but I succeeded in mounting shared volume on the /home/jovyan/shared.
Just changed the mount path.

kubectl describe pods -n z2jh jupyter-user
...

    Mounts:
      /home/jovyan from home (rw,path="archtest01")
      /home/jovyan/shared from jhdata-storage (rw)
singleuser:
  storage:
    type: static
    static:
      pvcName: pvc-home
      subPath: "{username}"

    extraVolumes:
    - name: jhdata-storage
      persistentVolumeClaim:
        claimName: pvc-data
    extraVolumeMounts:
    - name: jhdata-storage
      mountPath: /home/jovyan/shared # <-- Change HERE HERE HERE