Answer the question
In order to leave comments, you need to log in
Multiple Claims per Persistent Volumes?
Greetings friends.
I got my hands on poking Kubernetes with a stick, but for now, he beat me with a log :)
I make such a config for creating volumes, that is, one PersistentVolume and I want to attach a pair of PersistentVolumeClaim to it.
# Add persistent data dir
kind: PersistentVolume
apiVersion: v1
metadata:
name: persistent-data
labels:
type: local
spec:
storageClassName: persistent-data
capacity:
storage: 500Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
hostPath:
path: "/mnt/kubernetes"
---
# Add persistent data dir for Bind
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: bind-dns-data
spec:
storageClassName: persistent-data
accessModes:
- ReadWriteMany
resources:
requests:
storage: 500Mi
---
# Add persistent data dir for Zabbix
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: zabbix-data
spec:
storageClassName: persistent-data
accessModes:
- ReadWriteMany
resources:
requests:
storage: 20Gi
storageclass.storage.k8s.io "persistent-data" not found
requests:
storage: 20Gi
Answer the question
In order to leave comments, you need to log in
The bottom line is that PVs are static entities.
PVs are created manually and reflect the maximum physical amount that can be provided (actually, how much the administrator has decided to provide).
A PVC is essentially a request for a PV. Kubernetes will try to find a PV that matches the specified parameters - in your case, it will look for a free PV with a size of 20Gi or more. As soon as one is found, a PV-PVC link will be created - i.e. while the Claim is in effect, other pods will not be able to claim the same PV .
However, multiple pods can share the same PVC.
You may not have created a StorageClass with that name
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question