3

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?

Joshua Hansen
  • 356
  • 4
  • 7
  • For the time being, I've deployed a new cluster without HA, all on a single AZ, but hoping there's a better solution to this overall. – Joshua Hansen Jun 30 '17 at 22:25
  • From kubernetes version 1.6 and onwards you dont 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 same region which can easily be attached to your nodes. – slashRahul Jul 03 '17 at 17:31

1 Answers1

0

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.

slashRahul
  • 555
  • 5
  • 18
  • 3
    What if Pod reschedules on west-2b but PVC is still running on west-2a ? – Stephan Kristyn Feb 28 '18 at 16:47
  • 4
    This does not answer the question about how to ensure a deployment and persistentvolumeclaim are scheduled in the same AZ. I was hoping there was a way to include the persistentvolumeclaim in the deployment or pd spec – Michael Mar 23 '19 at 04:47