Answer a question

I had a broken mongo container that was not initializing, and I suspected that I could fix it by cleaning all the storage. So, I deleted the persistent storage being used, but now, every new storage that I create is in the "Lost" phase, and it's not found by in the mongo's POD creation.

This is the .yml file that I'm using to create the PV:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    pv.kubernetes.io/bind-completed: "yes"
    pv.kubernetes.io/bound-by-controller: "yes"
    volume.beta.kubernetes.io/storage-class: standard
    volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/gce-pd
  creationTimestamp: "2018-08-11T09:19:29Z"
  finalizers:
  - kubernetes.io/pvc-protection
  labels:
    environment: test
    role: mongo
  name: mongo-persistent-storage-mongo-db-0
  namespace: default
  resourceVersion: "122299922"
  selfLink: /api/v1/namespaces/default/persistentvolumeclaims/mongo-persistent-storage-mongo-db-0
  uid: a68de459-9d47-11e8-84b1-42010a800138
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi
  volumeMode: Filesystem
  volumeName: pvc-a68de459-9d47-11e8-84b1-42010a800135
status:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 20Gi
  phase: Bound

This is the error that I get when restarting the mongo POD:

error while running "VolumeBinding" filter plugin for pod "mongo-db-0": could not find v1.PersistentVolume "pvc-a68de459-9d47-11e8-84b1-42010a800135"

I already tryied changing the PV name and ids, but it didn't work.

Answers

This is the .yml file that I'm using to create the PV

It looks like you use a manifest that binds to a specific PV.

How about if you remove the unique fields and let the cluster dynamically provision a new PV for you?

Example:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    environment: test
    role: mongo
  name: mongo-persistent-storage-mongo-db-0
  namespace: default
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi
  volumeMode: Filesystem
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐