带有 GPD 卷的 Container-VM 映像失败,并显示“无法获取 GCE 云提供商".plugin.host.GetCloudProvider 返回 <nil>相反" [英] Container-VM Image with GPD Volumes fails with "Failed to get GCE Cloud Provider. plugin.host.GetCloudProvider returned <nil> instead"

查看:13
本文介绍了带有 GPD 卷的 Container-VM 映像失败,并显示“无法获取 GCE 云提供商".plugin.host.GetCloudProvider 返回 <nil>相反"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前尝试从Container-Optimized Google Compute Engine Images"(https://cloud.google.com/compute/docs/containers/container_vms) 到Container-VM"镜像(https://cloud.google.com/compute/docs/containers/vm-image/#overview).在我的容器.yaml 中,我定义了一个卷和一个使用该卷的容器.

I currently try to switch from the "Container-Optimized Google Compute Engine Images" (https://cloud.google.com/compute/docs/containers/container_vms) to the "Container-VM" Image (https://cloud.google.com/compute/docs/containers/vm-image/#overview). In my containers.yaml, I define a volume and a container using the volume.

apiVersion: v1
kind: Pod
metadata:
  name: workhorse
spec:
  containers:
    - name: postgres
      image: postgres:9.5
      imagePullPolicy: Always
      volumeMounts:
        - name: postgres-storage
          mountPath: /var/lib/postgresql/data
  volumes:
    - name: postgres-storage
      gcePersistentDisk:
        pdName: disk-name
        fsType: ext4

此设置适用于Container-Optimized Google Compute Engine Images",但不适用于Container-VM".在日志中,我可以看到以下错误:

This setup worked fine with the "Container-Optimized Google Compute Engine Images", however fails with the "Container-VM". In the logs, I can see the following error:

May 24 18:33:43 battleship kubelet[629]: E0524 18:33:43.405470 629 gce_util.go:176]
Error getting GCECloudProvider while detaching PD "disk-name":
Failed to get GCE Cloud Provider. plugin.host.GetCloudProvider returned <nil> instead

提前感谢您的任何提示!

Thanks in advance for any hint!

推荐答案

仅当 kubelet 在没有 --cloud-provider=gce 标志的情况下运行时才会发生这种情况.除非有什么不同,否则问题取决于 GCP 如何启动容器虚拟机.

This happens only when kubelet is run without the --cloud-provider=gce flag. The problem, unless is something different, is dependant on how GCP is launching Container-VMs.

请与谷歌云平台人员联系.

Please contact with google cloud platform guys.

请注意,在使用 GCE 时是否发生这种情况: 在所有工作线程中将 --cloud-provider=gce 标志添加到 kubelet.这仅适用于 1.2 集群版本,因为如果我没记错的话,有一个针对 1.3 集群的正在进行的附加/分离设计 将把这个业务逻辑移出 kubelet.

Note if this happens to you when using GCE: Add --cloud-provider=gce flag to kubelet in all your workers. This only applies to 1.2 cluster versions because, if i'm not wrong, there is an ongoing attach/detach design targeted for 1.3 clusters which will move this business logic out of kubelet.

如果有人对这里的附加/分离重新设计感兴趣,这是其对应的 github 问题:https://github.com/kubernetes/kubernetes/issues/20262

In case someone is interested in the attach/detach redesign here it is its corresponding github issue: https://github.com/kubernetes/kubernetes/issues/20262

这篇关于带有 GPD 卷的 Container-VM 映像失败,并显示“无法获取 GCE 云提供商".plugin.host.GetCloudProvider 返回 &lt;nil&gt;相反"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆