简体   繁体   English

如何确保我的Kubernetes EBS卷与部署位于相同的可用区中?

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

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. 我在AWS上有一个k8s集群(3个节点,分别位于us-east-1aus-east-1bus-east-1c ),并且尝试使用awsElasticBlockStore卷,但awsElasticBlockStore收到InvalidVolume.ZoneMismatch错误。

I create the volume via aws-cli : 我通过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: 我等待它变为available然后部署具有如下映射关系的k8s部署:

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? 如何保证我的EBS卷与部署在相同的可用区中? Is it via the deployment spec, or is there a better way to create/provision the awsElasticBlockStore that I'm overlooking? 是通过部署规范,还是有更好的方法来创建/设置我正在忽略的awsElasticBlockStore

From kubernetes version 1.6 and onwards you don't need to create EBS volume manually. 从kubernetes 1.6版开始,您无需手动创建EBS卷。 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. 创建一个PVC,它将为您自动创建一个具有所需大小的AWS卷,并在同一区域中将其轻松连接到您的节点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM