Home

Deploy Stateful EFS App with EKS

What is EFS?

  • Managed NFS that can be mounted on many EC2.
  • EFS works with EC2 instances in multi-AZ.
  • Highly available, scalable, expensive (3xgp2), pay per use.
Under the hood

Under the hood

EFS for Kubernetes

Using EFS, our Wordpress Pods can now be launched into any AZ, and therefore on any K8s worker nodes.

They will all access the same underlying HTML folder (therefore sharing state).

Enabling EFS

Heading to the AWS console. Head to the EFS page and create EFS. By default, it will try attach it to whateever VPC is available.

Ensure that you attach the correct node worker security groups that we are using for Kubernetes and not the default.

After adding, feel free to add a name tag but then accept the other defaults.

Ensure you take note of the DNS name and File System ID.

To be able to enable the EFS, we need to install amazon-efs-utils onto each of the worker nodes.

Example being ssh -i .ssh/path/to/key.pem ec2-user@REDACTED "sudo yum install -y amazon-efs-utils.

Creating the namespace and prepping storage

Layout

Layout

Steps:

  1. Create namespaces
  2. Create RBAC permissions
  3. Create EFS provisioner
  4. Create storageclass
  5. Create PVC's for MySQL and WordPress