Understanding the life cycle of a PersistentVolume object in Kubernetes
PersistentVolume
objects are good if you want to keep the state of your app without being constrained by the life cycle of the Pods or containers that are running them.
However, since PersistentVolume
objects get their very own life cycle, they have some very specific mechanics that you need to be aware of when you're using them. We'll take a closer look at them next.
Understanding that PersistentVolume objects are not bound to namespaces
The first thing to be aware of when you're using PersistentVolume
objects is that they are not namespaced
resources, but PersistentVolumeClaims
objects are.
$ kubectl api-resources --namespaced=false |grep -i volume
persistentvolumes pv v1 false PersistentVolume
volumeattachments storage.k8s.io/v1 false VolumeAttachment
So, if the Pod wants to use...