Skip to main content

component-shared-volume

Renders the PersistentVolumeClaims for cross-pod shared storage. Each entry in global.sharedVolumes becomes one PVC; the app chart's deployment template separately reads the same list to render volumes: + volumeMounts:.

The PVCs default to:

  • storageClassName: nfs (the RWX class provided by shared storage)
  • accessModes: [ReadWriteMany]

Schema

global:
sharedVolumes:
- name: <pvc-suffix> # PVC: <nameOverride>-<name>
size: <quantity> # required, e.g. 2Gi
storageClass: nfs # optional
accessMode: ReadWriteMany # optional
mounts:
- path: /absolute/path/in/container # required
subPath: <relative/path> # optional — mount a subdir of the PVC

Examples

One PVC, one mount

global:
sharedVolumes:
- name: uploads
size: 5Gi
mounts:
- path: /var/app/public/uploads

One PVC, multiple subPath mounts (typical Symfony case)

When several shared paths logically belong together — caches, generated assets — put them in one PVC and mount different subdirectories at the paths the app expects. One PVC = one entry in the NFS pool, one billing line, one capacity to size.

global:
sharedVolumes:
- name: shared
size: 2Gi
mounts:
- path: /var/app/var/cache
subPath: cache
- path: /var/app/public/cache
subPath: public-cache

Both mount points reference the same PVC app-shared, but the app sees two distinct directories backed by cache/ and public-cache/ inside that PVC.

Multiple PVCs

Use separate PVCs when sizes, retention, or growth profiles differ — for example, user uploads vs. ephemeral caches:

global:
sharedVolumes:
- name: shared
size: 2Gi
mounts:
- path: /var/app/var/cache
subPath: cache
- path: /var/app/public/cache
subPath: public-cache
- name: uploads
size: 20Gi
mounts:
- path: /var/app/public/uploads

This renders two PVCs (app-shared, app-uploads) and three mounts on the app container.

How to choose

QuestionIf yes →
Do these paths grow / get cleared together?One PVC, multiple subPath mounts
Are sizes very different (uploads vs caches)?Separate PVCs
Does one path need a different reclaim policy or retention?Separate PVCs
Is one path replaceable (rebuildable cache) and the other not (user data)?Separate PVCs

Caveats

  • The component is consumed by every app chart automatically — no enabled flag, no component-shared-volume.enabled: true needed. An empty (or absent) global.sharedVolumes renders nothing.
  • All RWX PVCs share the single in-cluster NFS pool. See Shared storage for the operational picture.
  • subPath directories inside a PVC are created on first mount; you don't need to pre-create them.