Kubernetes AWS shared persistent volume

4/23/2019

I have the following:

2 pod replicas, load balanced. Each replica having 2 containers sharing network.

What I am looking for is a shared volume...

I am looking for a solution where the 2 pods and each of the containers in the pods can share a directory with read+write access. So if a one container from pod 1 writes to it, containers from pod 2 will be able to access the new data.

Is this achievable with persistent volumes and PVCs? if so what do i need and what are pointers to more details around what FS would work best, static vs dynamic, and storage class.

Can the volume be an S3 bucket?

Thank you!

-- Assaf Moldavsky
amazon-web-services
kubernetes
kubernetes-pvc
persistent-volumes

2 Answers

4/23/2019

Refer to https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes for all available volume backends (You need ReadWriteMany compatibility)

As you can find there AWSElasticBlockStore doesn't support it. You will need any 3rd party volume provider which supports ReadWriteMany.

UPD: Another answer https://stackoverflow.com/a/51216537/923620 suggests that AWS EFS works too.

-- Max Lobur
Source: StackOverflow

4/23/2019

There are several options depending on price and efforts needed:

  1. Simplest but a bit more expensive solution is to use EFS + NFS Persistent Volumes. However, EFS has serious throughput limitations, read here for details.
  2. You can create pod with NFS-server inside and again mount NFS Persistent Volumes into pods. See example here. This requires more manual work and not completely highly available. If NFS-server pod fails, then you will observe some (hopefully) short downtime before it gets recreated.
  3. For HA configuration you can provision GlusterFS on Kubernetes. This requires the most efforts but allows for great flexibility and speed.
  4. Although mounting S3 into pods is somehow possible using awful crutches, this solution has numerous drawbacks and overall is not production grade. For testing purposes you can do that.
-- Vasily Angapov
Source: StackOverflow