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

<pre><code>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
</code></pre>

<p>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:</p>

<pre><code>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 &lt;nil&gt; instead
</code></pre>

<p>Thanks in advance for any hint!</p>

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

<p>Please contact with google cloud platform guys.</p>

<p><em>Note if this happens to you when using GCE:</em> Add <code>--cloud-provider=gce</code> flag to <code>kubelet</code> 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 <strike>which will move this business logic out of <code>kubelet</code></strike>. </p>

<p>In case someone is interested in the attach/detach redesign here it is its corresponding github issue: <a href="https://github.com/kubernetes/kubernetes/issues/20262" rel="nofollow">https://github.com/kubernetes/kubernetes/issues/20262</a></p>
