kubernetes pod unable to mount gcloud persistence disk after pod is deleted

7/31/2018

I have a working redis pod with gcloud persistence disk. Sometimes when deleting the pod the following error is thrown:

AttachVolume.Attach failed for volume "redis-volume" : GCE persistent disk not found: diskName="redis-volume" zone="europe-west3-c"

In case of failure deleting the pod once again resolve the issue - but this is not a sloution.

Using the following Kubernetes configuration:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: redis
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: redis
    spec:
      containers:
        - name: redis
          image: redis:3.2-alpine
          imagePullPolicy: Always
          args: ["--requirepass", "password", "--appendonly", "yes", "--save", "900", "1", "--save", "30", "1"]
          ports:
            - containerPort: 6379
              name: redis
          env:
          volumeMounts:
            - name: redis-volume
              mountPath: /data
      volumes:
        - name: redis-volume
          gcePersistentDisk:
            pdName: redis-volume
            fsType: ext4

Has any one encountered this issue?

-- Erez Ben Harush
gcloud
kubernetes

1 Answer

7/31/2018

I had the same problem that solved after separate the persistentvolume to the persistnetvolumeclaim.

The Deployment should use the claim. https://www.youtube.com/watch?v=n06kKYS6LZE

-- Oron Golan
Source: StackOverflow