Why AWS should pre-install the EBS driver on EKS!
Introduction:
I have been using EKS for over 3 years now and I have never understood why AWS decided not to have the EBS storage driver pre-installed on a new cluser. Storage is like oxygen - I never understood why something as basic as that shouldn’t be available pre-installed.
The Amazon EBS Container Storage Interface (CSI) driver is designed to handle the creation, management, and lifecycle of EBS volumes used as storage in Kubernetes environments. With this driver, you can easily provision and manage both persistent and ephemeral volumes for your Kubernetes applications.
Why is the EBS CSI Driver Not Pre-installed?
However, I tried to understand what would be the reason behind it. Maybe these?
- Modularity: AWS EKS follows a modular approach, so you install only the components you need for your specific workloads.
- Custom Storage Options: Enterprises may prefer custom storage solutions, so AWS leaves the decision up to the user.
- Multiple Storage Types: EKS supports various storage types (e.g., EFS), and EBS CSI needs to be added separately for EBS integration.
- Flexibility: AWS allows users to tailor their clusters and resources, avoiding unnecessary pre-installed features.
Whatever the case might be - I definitely would have liked it to be pre-installed! Do you agree?
Why Use the AWS EBS CSI Driver?
- Let’s say you’re deploying an application like WordPress on your Kubernetes cluster. For things like user-uploaded files, themes, and the database, reliable storage is essential. Without persistent storage, all this data would disappear whenever the pod is restarted or deleted, which happens frequently in Kubernetes due to scaling or updates.AWS provides several storage solutions, each suited to specific needs.
For example:This is where Amazon EBS comes in. EBS is specifically designed for block-level storage, making it ideal for applications like databases, big data, and file systems that require high-speed, low-latency access to data. EBS volumes act like physical hard drives attached to your instances, delivering the performance and durability required for production workloads.However, even though EBS is available, your Kubernetes cluster won’t be able to use it without the EBS CSI driver. This driver enables your cluster to request and manage EBS volumes automatically. So, despite AWS offering multiple storage options, EBS is often the best choice for applications needing fast, reliable, block-based storage, and installing the EBS CSI driver ensures your applications can fully leverage it.- Amazon S3 is excellent for storing large volumes of unstructured data, such as backups or media files. However, it’s not optimized for fast, transactional access, which is essential for databases and other performance-critical applications.
- Amazon EFS is perfect for shared access across multiple instances. While it’s great for workloads needing a network file system, it’s not ideal for situations where you need high-speed, direct-attached storage.
Features of the AWS EBS CSI Driver
- Customizable Storage Classes for EKS:
You can configure storage classes to suit your application’s needs, whether it requires high-performance SSD (gp2/io1) or more cost-efficient options. This flexibility is essential for running varied workloads on EKS.. - Snapshots for Data Protection in EKS:
You can take snapshots of EBS volumes directly from Kubernetes for backup or cloning purposes. This provides an easy way to safeguard your data or create new volumes for testing and development environments within EKS. - Volume Resizing without Downtime:
The driver allows for dynamic volume resizing in EKS, meaning that if your application requires more storage, you can expand volumes on the fly without any downtime.
How to Install the EBS CSI Driver in an EKS Cluster
Using eksctl
eksctl is a powerful CLI tool that simplifies the creation and management of EKS clusters. Although the EBS CSI driver is not installed by default, it can be easily added during or after cluster creation.
1. Create or Update an EKS Cluster with eksctl
To install the EBS CSI driver, you can either create a new EKS cluster or update an existing one:
eksctl create cluster --name my-cluster --region us-west-2 --with-oidc --managed
2. Install the EBS CSI Driver Add-on
eksctl create addon --name aws-ebs-csi-driver --cluster my-cluster --region us-west-2 --service-account-role-arn arn:aws:iam::<ACCOUNT_ID>:role/<IAM_ROLE_NAME>
This command will:
- Install the EBS CSI driver in your EKS cluster.
- Use the IAM OIDC provider for secure authentication between the cluster and AWS.
3. Verify Installation
To check if the driver is installed correctly and running:
kubectl get pods -n kube-system -l app=ebs-csi-controller
Using Terraform
For Infrastructure as Code (IaC) users, you can install the EBS CSI driver using Terraform. This approach simplifies the process of defining and maintaining your EKS cluster’s configuration.
1. Add the EBS CSI Driver Module to Your Terraform Configuration
In your Terraform configuration, define the EKS cluster and include the EBS CSI driver module:
cluster_addons = {
aws-ebs-csi-driver = {
service_account_role_arn = module.ebs_csi_irsa_role.iam_role_arn
resolve_conflicts = "PRESERVE"
}
}
2. Apply Changes
Initialize and apply the Terraform configuration to install the driver:
terraform init
terraform apply
This will install the EBS CSI driver and ensure your EKS cluster is capable of dynamically managing EBS volumes.
Conclusion
The AWS EBS CSI driver is a powerful tool that allows Kubernetes clusters to use Amazon EBS for persistent storage. Although it’s not pre-installed in Amazon EKS, you can easily install it using either eksctl or Terraform.
This guide provided an overview of why you need the driver, its key features, and how to install it in your EKS cluster.