Container-VM Image with GPD Volumes fails with “Failed to get GCE Cloud Provider. plugin.host.GetCloudProvider returned <nil> instead”

这一生的挚爱 提交于 2019-12-02 14:43:16

问题


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

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!


回答1:


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.

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.

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



来源:https://stackoverflow.com/questions/37421540/container-vm-image-with-gpd-volumes-fails-with-failed-to-get-gce-cloud-provider

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!