20 Mart 2023 Pazartesi

Kubernetes PV ve PVC AccessModes Uyumu

Giriş
Ş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: v1
kind: PersistentVolume
metadata:
  name: my-pv-rox
spec:
  storageClassName: standard
  capacity:
    storage: 5Gi
  accessModes:
    - ReadOnlyMany
  hostPath:
    path: /data/my-pv-rox

apiVersion: v1
kind: PersistentVolume
metadata:
  name: my-pv-rwx
spec:
  storageClassName: standard
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteMany
  hostPath:
    path: /data/my-pv-rwx

apiVersion: v1
kind: PersistentVolume
metadata:
  name: my-pv-rwo
spec:
  storageClassName: standard
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    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: v1
kind: 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







Hiç yorum yok:

Yorum Gönder

Cluster Propotional Autoscaler - ReplicaSet Ekler/Siler

Giriş Açıklaması şöyle CPA aims to horizontally scale the number of Pod replicas based on the cluster’s scale. A common example is DNS ser...