I am trying to orchestrate stateful application with postgres as backend with k8s on AWS. I am able to get the k8s working nicely on AWS and deploy test projects in one weeks time.
I have postgres on docker container and trying to configure EBS volume for multiple containers on different nodes. (something like above). postgres container basically exposes port 5432 of container and does data manipulation on db.
But one of the limitations of AWS I came across was EBS can only be mounted on single EC2. Does it mean I have to keep only single EC2 (node) with multiple pods or single pod with multiple containers on it? (shown below) Which design is better from the k8s point of view? I will be creating service on top of Postgres containers/pods which can be accessed by API deployment done with k8s.
I went through k8s volumes documentation and it mentions that every time pod is restarted volume is mounted back on the pod. What does it mean? Will there be downtime to mount back the volume?
Is there any better way or approach to do this?
Any guidance or links is highly appreciated. Thank you for your time and patience.