Skip to content

Latest commit

 

History

History
81 lines (71 loc) · 2.35 KB

multi-attach.md

File metadata and controls

81 lines (71 loc) · 2.35 KB

Multi-Attach

The multi-attach capability allows you to attach a single EBS volume to multiple EC2 instances located within the same Availability Zone (AZ). This shared volume can be utilized by several pods running on distinct nodes.

Important

  • EBS Multi-Attach does not support standard file systems. Standard file systems such as XFS, EXT3, EXT4, and NTFS aren't designed to be simultaneously accessed by multiple servers or EC2 instances.
  • Simultaneous access to a standard file system can result in data corruption or data loss.
  • You should use a clustered file system to ensure data resiliency and reliability for your production workloads.
  • Multi-Attach is only enabled for IO2 block devices.

Refer to the official AWS documentation on Multi-Attach for more information, best practices, and limitations of this capability.

Example

  1. Create a StorageClass referencing an IO2 volume type:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: ebs-sc
provisioner: ebs.csi.aws.com
volumeBindingMode: WaitForFirstConsumer
parameters:
  type: io2
  iops: "1000"
  1. Create a PersistentVolumeClaim referencing the ReadWriteMany access and Block device modes:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: block-claim
spec:
  accessModes:
    - ReadWriteMany
  volumeMode: Block
  storageClassName: ebs-sc
  resources:
    requests:
      storage: 4Gi
  1. Create a DaemonSet to deploy the driver on all nodes:
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: app-daemon
spec:
  selector:
    matchLabels:
      name: app
  template:
    metadata:
      labels:
        name: app
    spec:
      containers:
      - name: app
        image: busybox
        command: ["/bin/sh", "-c"]
        args: ["tail -f /dev/null"]
        volumeDevices:
        - name: data
          devicePath: /dev/xvda
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: block-claim
  1. Verify the DaemonSet is running:
$ kubectl get pods -A

NAMESPACE     NAME                                   READY   STATUS    RESTARTS       AGE
default       app-daemon-9hdgw                       1/1     Running   0              18s
default       app-daemon-xm8zr                       1/1     Running   0              18s