0
votes

I have a kubernetes deployment with three replicas, each one in one AZ (eu-west-1a,eu-west-1b and eu-west-1c). I have three AWS EBS volumes (each one in a different AZ) that I want to attach to each replica.

I know I can attach the volume with volume type awsElasticBlockStore but, how can I match each volume to the replica matching the AZ?

2
You probably want a statefulset here.johnharris85
but if you still want to use a deployment and not statefulset , use PVs as local volumes , as local volumes binds to nodes and then use node selectorsIjaz Ahmad Khan

2 Answers

0
votes

as suggested above, you have below choices

  1. Use statefulsets. then each replica would get independent storage volume
  2. use local volumes ( supported on 1.14 and above )
  3. There is a PR already to enable independent storage for each replica. follow the link https://github.com/openshift/origin/issues/4211
0
votes

Optionally, you can map AWS EBS volumes within failure-domain.beta.kubernetes.io/zone built-in label, thus you don't need to make a local volumes accross Statefulsets. It will give you a chance to bind persistent volume claims (PVCs) to persistent volumes (PVs) residing on the same node matching appropriate availability zone, as I've suggested in the separate Stack thread.