<p>I'm trying to install Redis cluster (StatefulSet) out of GKE and when getting pvc I've got </p>

<pre><code>Events:
  Type       Reason              Age   From                         Message
  ----       ------              ----  ----                         -------
  Warning    ProvisioningFailed  10s   persistentvolume-controller  Failed to provision volume with StorageClass "slow": Failed to get GCE GCECloudProvider with error &lt;nil&gt;
</code></pre>

<p>Already added "--cloud-provider=gce" on files /etc/kubernetes/manifests/kube-controller-manager.yaml and sudo vi /etc/kubernetes/manifests/kube-apiserver.yaml. Restarted but still the same. 
Can anyone help me please? What's the trick for making k8s work on GCP?</p>

<p>My manifest taken from <a href="https://stackoverflow.com/questions/50100219/kubernetes-failed-to-get-gce-gcecloudprovider-with-error-nil">here</a>:</p>

<pre><code>---
apiVersion: v1
kind: ConfigMap
metadata:
  name: redis-cluster
  labels:
    app: redis-cluster
data:
  fix-ip.sh: |
    #!/bin/sh
    CLUSTER_CONFIG="/data/nodes.conf"
    if [ -f ${CLUSTER_CONFIG} ]; then
      if [ -z "${POD_IP}" ]; then 
        echo "Unable to determine Pod IP address!"
        exit 1
      fi
      echo "Updating my IP to ${POD_IP} in ${CLUSTER_CONFIG}"
      sed -i.bak -e "/myself/ s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/${POD_IP}/" ${CLUSTER_CONFIG}
    fi
    exec "$@"
  redis.conf: |+
    cluster-enabled yes
    cluster-require-full-coverage no
    cluster-node-timeout 15000
    cluster-config-file /data/nodes.conf
    cluster-migration-barrier 1
    appendonly yes
    protected-mode no
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: slow
provisioner: kubernetes.io/gce-pd
parameters:
  type: pd-standard
  replication-type: none
  zone: "us-west2-a"
  reclaimPolicy: Retain
---
apiVersion: v1
kind: Service
metadata:
  name: redis-cluster
  labels:
    app: redis-cluster
spec:
  ports:
  - port: 6379
    targetPort: 6379
    name: client
  - port: 16379
    targetPort: 16379
    name: gossip
  clusterIP: None
  selector:
    app: redis-cluster
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: redis-cluster
  labels:
    app: redis-cluster
spec:
  serviceName: redis-cluster
  replicas: 5
  selector:
    matchLabels:
      app: redis-cluster
  template:
    metadata:
      labels:
        app: redis-cluster
    spec:
      containers:
      - name: redis
        image: redis:5.0-rc
        ports:
        - containerPort: 6379
          name: client
        - containerPort: 16379
          name: gossip
        command: ["/conf/fix-ip.sh", "redis-server", "/conf/redis.conf"]
        args:
        - --cluster-announce-ip
        - "$(POD_IP)"
        readinessProbe:
          exec:
            command:
            - sh
            - -c
            - "redis-cli -h $(hostname) ping"
          initialDelaySeconds: 15
          timeoutSeconds: 5
        livenessProbe:
          exec:
            command:
            - sh
            - -c
            - "redis-cli -h $(hostname) ping"
          initialDelaySeconds: 20
          periodSeconds: 3
        env:
        - name: POD_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        volumeMounts:
        - name: conf
          mountPath: /conf
          readOnly: false
        - name: data
          mountPath: /data
          readOnly: false
      volumes:
      - name: conf
        configMap:
          name: redis-cluster
          defaultMode: 0755
  volumeClaimTemplates:
  - metadata:
      name: data
      labels:
        name: redis-cluster
    spec:
      accessModes: [ "ReadWriteOnce" ]
      storageClassName: slow 
      resources:
        requests:
          storage: 5Gi
</code></pre>

<p>Please verify your "StorageClass: slow", it seems there is an indentation problem (starting with reclaimPolicy) </p>

<pre><code>kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: slow
provisioner: kubernetes.io/gce-pd
parameters:
  type: pd-standard
  replication-type: none
  zone: "us-west2-a"
reclaimPolicy: Retain
</code></pre>

<p>#
Update:</p>

<ol>
<li><p>Please add <code>--cloud-provider=gce</code> into: <a href="https://stackoverflow.com/questions/50100219/kubernetes-failed-to-get-gce-gcecloudprovider-with-error-nil"><strong>kube-apiserver.yaml, kube-controller-manager.yaml, KUBELET_KUBECONFIG_ARGS</strong></a>. You can also enable <strong>enable-admission-plugins=<a href="https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/" rel="nofollow noreferrer">DefaultStorageClass</a></strong></p></li>
<li><p>Verify in your <strong>"VM instance details"</strong> permissiosn in <strong>"Cloud API access scopes" permissions.</strong></p></li>
<li><p>Verify if your storage class pv and pvc are working properly.</p></li>
</ol>

<hr>

<pre><code>  kind: StorageClass
    apiVersion: storage.k8s.io/v1beta1
    metadata:
      name: slow
      annotations:
        storageclass.beta.kubernetes.io/is-default-class: "true" 
    provisioner: kubernetes.io/gce-pd
    parameters:
      type: pd-standard      

  apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
     name: pvc-test
    spec:
     accessModes:
      - ReadOnlyMany
     storageClassName: slow
     resources:
       requests:
         storage: 1Gi
</code></pre>
