Persistent Volumes
Deployment vs. StatefulSet
-
Deployments with Persistent Volumes
When using EBS volumes with deployments, the volume must be attached to a specific node. As a result, Pods can only run on that node to access the volume.
-
StatefulSet with Persistent Volumes
StatefulSets are ideal for applications like Kafka, Zookeeper, and Cassandra. They allow multiple Pods to run across different nodes, with each Pod having its own attached persistent volume.
Amazon EBS Volumes
Key points about using EBS volumes for persistent storage in EKS:
- EBS volumes are tied to a specific Availability Zone (AZ).
- Pods must start in the same AZ as the EBS volume.
- Pods in the same AZ can share the volume, but not across nodes.
- Each AZ requires its own EBS volume.
For multi-AZ storage, use Amazon EFS, which supports cross-AZ access.
Amazon EFS
Amazon EFS is a managed file system that can be shared across multiple EC2 instances and availability zones:
- Spans across availability zones (AZs)
- Instances in different AZs can share the same EFS
- Highly scalable, available, but is very expensive
- You pay per amount of storage you use
EFS for Kubernetes
Once we use EFS as the persistent storage for our cluster, we can no launch the Pods in any of the availability zones in a region.
-
EFS is mounted onto the worker nodes
-
instances can start sharing state config files