简体   繁体   English

GCE Persistent Disk 与 Kubernetes Pod 相同的区域?

[英]GCE Persistent Disk Same zone as Kubernetes Pod?

I am trying to mount a GCE persistent disk in a kubernetes pod via the deployment object yaml.我正在尝试通过部署对象 yaml 在 kubernetes pod 中挂载 GCE 永久磁盘。 I am observing this behavior that as long as the node (on which the pod resides) is in the same zone as the persistent disk (say us-central1-a), the mounting succeeds.我观察到这种行为,只要节点(pod 所在的节点)与永久性磁盘(例如 us-central1-a)位于同一区域,挂载就会成功。 However, if there are in different zones (say node in us-central1-a and disk in us-central1-b) then mounting times out.但是,如果有不同的区域(比如 us-central1-a 中的节点和 us-central1-b 中的磁盘),则安装超时。

Is this behavior valid?这种行为有效吗? I could not find anything in the documentation that verifies that it is.我在文档中找不到任何可以验证它的内容。

http://kubernetes.io/docs/user-guide/volumes/#gcePersistentDisk http://kubernetes.io/docs/user-guide/volumes/#gcePersistentDisk

We are using multi-zone clusters which is making it cumbersome to load the right disk.我们正在使用多区域集群,这使得加载正确的磁盘变得很麻烦。

You can use this nodeSelector:您可以使用此节点选择器:

    nodeSelector:
      failure-domain.beta.kubernetes.io/zone: us-central1-b

GCE Persistent Disks 是一种区域资源,因此 pod 只能请求位于其区域内的 PD。

you need to schedule your pods on the same PD zone.您需要将 pod 安排在同一个 PD 区域上。 In order to do that you need to use nodeSelector or nodeAffinity:required.为此,您需要使用 nodeSelector 或 nodeAffinity:required。

If you are using dynamically provisioned volumes, this needs to be topology aware.如果您使用动态配置的卷,则需要具有拓扑感知能力。 This is accomplished by setting the volumeBindingMode for the storage class to WaitForFirstConsumer: volume binding这是通过将存储类的 volumeBindingMode 设置为 WaitForFirstConsumer 来实现的: volume binding

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

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