Şeklen şöyle
Açıklaması şöyle
ReadWriteOnce (RWO): This is the default access mode. It allows the PVC to be mounted as read-write by a single node in the cluster. This means that the PVC can be used by a single pod running on that node and is not available to other nodes in the cluster.ReadOnlyMany (ROX): This access mode allows the PVC to be mounted as read-only by many nodes in the cluster. This means that the PVC can be used by multiple pods running on different nodes, but they can only read from it, not write to it.ReadWriteMany (RWX): This access mode allows the PVC to be mounted as read-write by many nodes in the cluster. This means that the PVC can be used by multiple pods running on different nodes, and they can both read from and write to it.ReadWriteOncePod: The ReadWriteOncePod storage class is a pre-defined storage class that can be used to create a persistent volume with ReadWriteOnce access mode that is intended to be used by a single pod. Kubernetes ensures that pod is the only pod across your whole cluster that can read that PVC or write to it.
Örnek
3 tane PV şöyle olsun. Hepsi hostPath kullanıyor.
1. ReadOnlyMany
2. ReadWriteMany
3. ReadWriteOnce
apiVersion: v1kind: PersistentVolumemetadata:name: my-pv-roxspec:storageClassName: standardcapacity:storage: 5GiaccessModes:- ReadOnlyManyhostPath:path: /data/my-pv-roxapiVersion: v1kind: PersistentVolumemetadata:name: my-pv-rwxspec:storageClassName: standardcapacity:storage: 5GiaccessModes:- ReadWriteManyhostPath:path: /data/my-pv-rwxapiVersion: v1kind: PersistentVolumemetadata:name: my-pv-rwospec:storageClassName: standardcapacity:storage: 5GiaccessModes:- ReadWriteOncehostPath:path: /data/my-pv-rwo
Bunlarla uyumlu 3 tane PVC yaratmak için şöyle yaparız. Hepsinin storageClassName ismi standard ve accessModes şöyle
1. ReadOnlyMany
2. ReadWriteMany
3. ReadWriteOnce
apiVersion: v1kind: PersistentVolumeClaim metadata: name: my-pvc-rox spec: storageClassName: standard accessModes: - ReadOnlyMany resources: requests: storage: 1Gi apiVersion: v1 kind: PersistentVolumeClaim metadata: name: my-pvc-rwx spec: storageClassName: standard accessModes: - ReadWriteMany resources: requests: storage: 1Gi apiVersion: v1 kind: PersistentVolumeClaim metadata: name: my-pvc-rwo spec: storageClassName: standard accessModes: - ReadWriteOnce resources: requests: storage: 1Gi