Provision and Mount AWS EBS Volume in Kubernetes

PracticiumMay 1, 2026

Provision and Mount AWS EBS Volume in Kubernetes

This guide explains how to manually create an Amazon EBS volume in AWS, define it as a PersistentVolume in Kubernetes, bind it with a PersistentVolumeClaim, and mount it inside a pod.

Step 1: Create EBS Volume in AWS

Navigate to EC2 β†’ Volumes β†’ Create Volume. Choose size, type (gp3, io1, etc.), and Availability Zone. Ensure the AZ matches the worker node where the pod will run.

Kubernetes EBS CSI Driver Architecture
Kubernetes EBS CSI Driver Architecture

Step 2: Tag the Volume

Add descriptive tags such as Name=app-data for easier identification and management.

Step 3: Define PersistentVolume (PV)

Create a Kubernetes PV manifest referencing the EBS volume ID. Example:

apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-app-data
spec:
capacity:
storage: 20Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: ""
awsElasticBlockStore:
volumeID: vol-0abcd1234efgh5678
fsType: ext4

Step 4: Define PersistentVolumeClaim (PVC)

Create a PVC that requests storage matching the PV. Example:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-app-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
storageClassName: ""

Step 5: Mount Volume in Pod

Reference the PVC in your pod or deployment manifest. Example:

apiVersion: apps/v1
kind: Deployment
metadata:
name: app-deployment
spec:
replicas: 1
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: myapp-container
image: nginx
volumeMounts:
- mountPath: /usr/share/nginx/html
name: app-storage
volumes:
- name: app-storage
persistentVolumeClaim:
claimName: pvc-app-data

Step 6: Verify Setup

  • Run `kubectl get pv,pvc` to confirm PVC is bound.
  • Run `kubectl describe pod <pod-name>` to check volume mount.
  • Write files inside the container at the mount path and confirm persistence.

Best Practices

  • Ensure the EBS volume AZ matches the node AZ.
  • Use StorageClass for dynamic provisioning to avoid manual volume creation.
  • Set reclaim policy to Retain if you want to preserve data after PVC deletion.