Can we use kubernetes volumes for deployments? If yes than that will be mutliple pods sharing the same volume? If that is possible then what happens when all the pods for the deployment are on different host machines? Especially when using Amazon EBS where an ebs volume cannot be shared across multiple hosts.
Can kubernetes volumes be used for deployments? If so what happens if each pod is on different host?
Asked
Active
Viewed 72 times
-1
-
Why wouldn't you use a Docker image instead, since that's how Kubernetes normally deals with code deployments? (In an AWS context, push the built images to ECR.) – David Maze Dec 25 '21 at 15:32
-
This was more of a learning and curiosity question. – Arpan Solanki Dec 25 '21 at 22:11
1 Answers
2
- Yes, you can use a persistent volume for deployments
- Such a volume will be mounted to your desired location in all the pods
- If you use EBS block storage, all your pods will need to be scheduled on the same node where you have attached your volume. This may not work if you have many replicas
- You will have to use a network file storage, such as EFS, GlusterFS, Portworx, etc. with ReadWriteMany if you want your pods to be spun up on different nodes
- EBS will give you the best performance with the aforementioned single node limitation

Rakesh Gupta
- 3,507
- 3
- 18
- 24
-
-
@arpansolanki please accept the answer and close the question. Thanks – Rakesh Gupta Dec 26 '21 at 12:53