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?
From kubernetes version 1.6 and onwards you don't need to create EBS volume manually. Create a PVC and it will automatically create a AWS volume for you with the required size and in the same region which can easily be attached to your nodes.