Why is my MongoDB operator pod failing to start?
The MongoDB operator deploys and manages your replica set. If the operator is not running, the replica set is not deployed. Common causes are insufficient RBAC permissions and failures pulling the operator image from the registry.
To debug, check the logs and inspect the deployment with these commands:
kubectl logs deployment/mongodb-kubernetes-operator -n rocketchat
kubectl describe deployment mongodb-kubernetes-operator -n rocketchatWhy is my MongoDB pod failing to start?
To find the cause, run these checks:
Check the MongoDB operator logs:
kubectl logs deployment/mongodb-kubernetes-operator -n rocketchatCheck the MongoDB pod logs:
kubectl logs mongodb-0 -n rocketchatVerify that the persistent volumes have enough space:
kubectl get pvc -n rocketchatCheck whether the MongoDBCommunity resource reports errors:
kubectl describe mongodbcommunity mongodb -n rocketchat
The mongodb-svc exists, but has no endpoints. Why?
mongodb-svc exists, but has no endpoints. Why?If the endpoints are empty, the selector on the service doesn't match the labels on the pods. The MongoDB Kubernetes operator manages service selectors and pod labels automatically. If you encounter this issue, verify that you haven't overridden the serviceName, selector, or template labels in the statefulSet spec.
To verify:
kubectl get svc mongodb-svc -n rocketchat -o yaml | grep selector -A 5
kubectl get pod mongodb-0 -n rocketchat -o yaml | grep labels -A 5The selector values in the service must match the labels on the pod.
Why can’t Rocket.Chat connect to MongoDB?
If Rocket.Chat can’t connect to MongoDB, run these checks:
Verify that MongoDB is running:
kubectl get pods -n rocketchat | grep mongodbTest the connection string manually. Replace
<password>with the password of therocketchatdatabase user:kubectl run -it --rm debug --image=mongo:8.2.3 --restart=Never -n rocketchat -- mongosh "mongodb://rocketchat:<password>@mongodb-0.mongodb-svc.rocketchat.svc.cluster.local:27017/rocketchat?authSource=rocketchat"Check the Rocket.Chat logs for connection errors:
kubectl logs <rocketchat-pod-name> -n rocketchatVerify that the MongoDB service is accessible:
kubectl get svc -n rocketchat | grep mongodbConfirm that the MongoDB service endpoints exist:
kubectl get endpoints mongodb-svc -n rocketchat
My old Bitnami MongoDB pod is still running after the upgrade. Should I delete it?
The Helm upgrade usually removes it, but legacy persistent volume claims (PVCs) can remain. If the old Bitnami MongoDB pod is still running:
Verify that your data is in the new MongoDB instance.
Look for orphaned volumes:
kubectl get pvc -n rocketchatAfter you confirm the migration succeeded, delete the old PVCs manually.
Deleting a PVC permanently removes the data on it. Confirm that the new MongoDB instance has all your data first.