# Centralized Storage for JupyterHub Users on Kubernetes

**URL:** <https://discourse.jupyter.org/t/centralized-storage-for-jupyterhub-users-on-kubernetes/30647>\
**Category:** JupyterHub\
**Tags:** help-wanted\
**Created:** [December 4, 2024, 9:15am UTC](https://discourse.jupyter.org/t/centralized-storage-for-jupyterhub-users-on-kubernetes/30647 "2024-12-04T09:15:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Divyesh\_Bhalekar](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/divyesh_bhalekar/32/16200_2.png) [@Divyesh\_Bhalekar](https://discourse.jupyter.org/u/Divyesh_Bhalekar)\
**Post date:** [December 4, 2024, 9:15am UTC](https://discourse.jupyter.org/t/centralized-storage-for-jupyterhub-users-on-kubernetes/30647/1 "2024-12-04T09:15:09Z")

</div>

Hello everyone,

I have deployed JupyterHub on my Kubernetes cluster, and it’s working well. However, I noticed that it creates a separate PersistentVolumeClaim (PVC) for each user who logs in to the Jupyter notebook.

this is what i have installed

> **[jupyterhub 4.0.1-0.dev.git.6880.h3d7f40af · jupyterhub/jupyterhub](https://artifacthub.io/packages/helm/jupyterhub/jupyterhub?modal=install)**
>
> Multi-user Jupyter installation

While this setup works, I would prefer a more centralized storage solution where either:

1. A single, shared PVC is used for all users instead of creating one for each user.
2. Alternatively, a solution where user data can be stored in a database like PostgreSQL instead of using PVCs.

Has anyone implemented a similar setup or can suggest best practices to achieve this?

Thanks in advance for your help!

---

<div class="post-metadata">

**Author:** ![manics](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/manics/32/85_2.png) [@manics](https://discourse.jupyter.org/u/manics)\
**Post date:** [December 4, 2024, 12:17pm UTC](https://discourse.jupyter.org/t/centralized-storage-for-jupyterhub-users-on-kubernetes/30647/2 "2024-12-04T12:17:12Z")

</div>

You could disable dynamic user storage, and instead mount a subpath of a single volume:

- [Customizing User Storage — Zero to JupyterHub with Kubernetes documentation](https://z2jh.jupyter.org/en/stable/jupyterhub/customizing/user-storage.html#additional-storage-volumes)
- [Volumes | Kubernetes](https://kubernetes.io/docs/concepts/storage/volumes/#using-subpath)

Your Kubernetes Storage Controller needs to support mounting a single volume to multiple pods, not all controllers do.

See for example

> <https://github.com/jupyterhub/zero-to-jupyterhub-k8s/issues/421#issuecomment-1044193066>
>
> NFS is still a very popular storage setup, and is a good fit for use with z2jh i…n several cases:
> 
> 1. When you are supporting a large number of users
> 2. When you are running on baremetal and NFS is your only option
> 3. When your utilization % (% of total users active at any time) is very low, causing you to spend more on storage than compute.
> 
> While we don't want to be on the hook for teaching users to setup and maintain NFS servers, we should document how to use an NFS serer that already exists.
