EBS CSI Driver

The EBS CSI driver lets pods use Amazon EBS volumes as fast, block-level persistent storage.

Pods are ephemeral — when one restarts its local disk is gone. For durable, single-node block storage, EKS uses the Amazon EBS CSI driver to attach EBS volumes to pods.

How it fits together

  1. You install the EBS CSI driver (usually as a managed add-on).
  2. A StorageClass describes the kind of EBS volume (type, IOPS, encryption).
  3. A PersistentVolumeClaim requests storage; the driver dynamically provisions an EBS volume and attaches it to the node running the pod.

Key characteristics

  • ReadWriteOnce — an EBS volume attaches to one node at a time, so it suits databases and single-writer apps.
  • The volume must be in the same Availability Zone as the pod, which affects scheduling.

Example

Example · bash
# Install the EBS CSI driver as a managed add-on
aws eks create-addon \
  --cluster-name demo \
  --addon-name aws-ebs-csi-driver \
  --service-account-role-arn arn:aws:iam::111122223333:role/EbsCsiRole

kubectl get pods -n kube-system -l app=ebs-csi-controller

When to use it

  • A database team mounts an EBS gp3 volume to a single PostgreSQL pod, getting consistent IOPS without the network overhead of a shared file system.
  • A data engineering team provisions encrypted EBS volumes for Kafka brokers by setting the encrypted flag in the StorageClass.
  • A DevOps engineer configures the EBS CSI driver with a VolumeSnapshotClass so daily snapshots of stateful pod volumes are automated.

More examples

Install EBS CSI driver add-on

Installs the EBS CSI driver as a managed EKS add-on with an IRSA role, then checks the add-on reaches ACTIVE status.

Example · bash
aws eks create-addon \
  --cluster-name prod \
  --addon-name aws-ebs-csi-driver \
  --service-account-role-arn arn:aws:iam::123456789012:role/EBSCSIDriverRole
aws eks describe-addon \
  --cluster-name prod \
  --addon-name aws-ebs-csi-driver \
  --query 'addon.status'

gp3 StorageClass definition

Defines a gp3 StorageClass with explicit IOPS, throughput, and encryption settings for EBS volumes provisioned by the CSI driver.

Example · yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: ebs-gp3
provisioner: ebs.csi.aws.com
volumeBindingMode: WaitForFirstConsumer
parameters:
  type: gp3
  iops: "3000"
  throughput: "125"
  encrypted: "true"

PVC using EBS StorageClass

A PVC that requests a 50 GiB encrypted gp3 EBS volume; WaitForFirstConsumer ensures the volume is created in the same AZ as the pod.

Example · yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: postgres-data
spec:
  accessModes: [ReadWriteOnce]
  storageClassName: ebs-gp3
  resources:
    requests:
      storage: 50Gi

Discussion

  • Be the first to comment on this lesson.