Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

MongoDB pods cannot start due to persistent volume mounting error.

\uD83C\uDF31 Solution

Redeploy MongoDB to use a new Recreate persistent volume claim.

  1. Run command: kubectl delete statefulset mongo -n <onelist namespace>

  2. Download the mongo.yaml file below.

View file
namemongo.yaml

3. Edit the mongo.yaml file. Change the persistent volume name to a new value that is different to the current value in your cluster. For example: mongo-persistent-volume-2.

...

4. Run command: kubectl apply -f mongo.yaml -n <onelist namespace>

...

  1. Open MongoDB statefulset deployment yaml.

  2. Set replicas to 0. Save and wait for all pods terminates.

    Image Added
  3. Go to Storage → Persistent volume claims. Select the persistent volume claim belongs to the failing mogodb deployment and delete it.

    Image Added
  4. Go back to the MongoDB stateful set deployment yaml and change replicas to 1.

  5. The pod should be able to start now.