...
MongoDB pods cannot start due to persistent volume mounting error.
\uD83C\uDF31 Solution
Redeploy MongoDB to use a new Recreate persistent volume claim.
Run command: kubectl delete statefulset mongo -n <onelist namespace>
Download the mongo.yaml file below.
View file | ||
---|---|---|
|
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>
...
Open to MongoDB statefulset deployment yaml.
Set
replicas
to 0. Save and wait for all pods terminates.Go to Storage → Persistent volume claims. Select the persistent volume claim belongs to the failing mogodb deployment and delete it.
Go back to the MongoDB stateful set deployment yaml and change replicas to 1.
The pod should be able to start now.