Minikube PV와 PVC의 accessModes 사용방법

2025. 1. 4. 14:49k8s

The accessModes field in PersistentVolume (PV) and PersistentVolumeClaim (PVC) specifies the types of access permissions available for the volume. It determines how the volume can be mounted by Pods.

Access Modes:

  1. ReadWriteOnce (RWO)
    • Description: The volume can be mounted as read-write by a single node.
    • Use Case: Suitable for scenarios where only one Pod requires write access at a time, such as block storage systems.
    • Example Storage: AWS EBS, Azure Disk, GCE Persistent Disk.
  2. ReadOnlyMany (ROX)
    • Description: The volume can be mounted as read-only by multiple nodes.
    • Use Case: Ideal for shared data that doesn't require modifications, like configuration files or logs.
    • Example Storage: NFS, Google Cloud Storage.
  3. ReadWriteMany (RWX)
    • Description: The volume can be mounted as read-write by multiple nodes simultaneously.
    • Use Case: Suitable for shared workloads where multiple Pods need simultaneous write access, such as shared logs or data processing.
    • Example Storage: NFS, GlusterFS, CephFS.
  4. ReadWriteOncePod (RWOP) (Kubernetes 1.22+)
    • Description: The volume can be mounted as read-write by only one Pod on a single node.
    • Use Case: Useful for exclusive write access by a single Pod in StatefulSets.
    • Example Storage: CSI drivers supporting this mode.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: example-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi