带有 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"
问题描述
我目前尝试从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).在我的 containers.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 如何启动 Container-VM.
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 返回 <nil>而是“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!