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

Configure MongoDB to use a new Recreate persistent volume claim.

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

  2. Change volumeMounts.name to a different value. For example: mongo-persistent-volume-2. Save the change.

    Image Removed
  3. MongoDB pods will restart. A new persistent volume will be created and mounted by the new podsOpen MongoDB statefulset deployment yaml.

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

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

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

  7. The pod should be able to start now.