When I create a PerconaServerMongoDB in replicaset mode, my pods restart constantly due to failed liveness probes with this error: “connection error: no reachable servers”.
I can connect to the pod and run /data/db/mongodb-healthcheck k8s liveness --ssl --sslInsecure --sslCAFile /etc/mongodb-ssl/ca.crt --sslPEMKeyFile /tmp/tls.pem as in the liveness probe definition and indeed it fails with the same connection error.
I am running on RKE 1.18.6. My CR will be in the comment.
because your cr.yaml looks not correct ← load the original file in a editor where you can see clearly what belongs to what … and tell what you actually want (only replicaset ? with sharding ?)
I did load the original file from Github and modify it to meet my need, so it looks a bit different than the original one. Can you point out which part of my cr.yaml doesn’t look correct please?
Just to make sure, I tried putting the original file on, same error. I hope it isn’t a platform-specific issue. I made it work a few weeks ago with GKE and now I’m trying to make it work on an on-premise RKE cluster.
Actually it turns out that the problem only happen when I expose the replicaset with LoadBalancer or NodePort.
When I use NodePort and connect to one of the pod and launch: mongo --host <node_ip> --port <node_port>
It returns connection refused.
By curiosity I tried spinning up a single pod running percona/percona-server-mongodb:4.4.6-8 image and start mongod --bind_ip_all --port 27017, then expose the port as a NodePort service, I can connect to this test mongo normally.