Kubernetes Persisent Volume
I am seeking a clarification on the Persistent Volume in Kubernetes.
In this below example, the /my-test-project is in the persistent volume. Then, why I need these mounts as technically my entire directory /my-test-project is persisted? How would these mountpath and subpath help if entire directory is persisted?
volumeMounts:
- name: empty-dir-volume
mountPath: /my-test-project/data-cache
subPath: data-cache
- name: empty-dir-volume
mountPath: /my-test-project/user-cache
subPath: user-cache
volumes:
- name: empty-dir-volume
emptyDir: {}