How to guarantee that my Kubernetes EBS volume will be in the same AZ as the deployment?

Viewed 922

I have a k8s cluster on AWS (3 nodes, across us-east-1a, us-east-1b and us-east-1c) and I'm trying to use an awsElasticBlockStore volume but I keep getting a InvalidVolume.ZoneMismatch error.

I create the volume via aws-cli:

aws ec2 create-volume --availability-zone us-east-1a --size 10

I wait for it to become available then deploy my k8s deployment that has it mapped like so:

volumes: - name: myVol awsElasticBlockStore: volumeID: <volume-id-from-above> fsType: ext4

How can I guarantee that my EBS volume will be in the same AZ as the deployment? Is it via the deployment spec, or is there a better way to create/provision the awsElasticBlockStore that I'm overlooking?

1 Answers
Related