1- Run a container with a MongoDB client and connect its console output to your terminal. The following command does this, naming the new Pod percona-client:
kubectl -n run -i --rm --tty percona-client --image=percona/percona-server-mongodb:8.0.19-7 --restart=Never – bash -il
2- Connect to Percona Server for MongoDB. The format of the MongoDB connection URI string is the following (sharding is off):
mongosh “mongodb://:@-rs0..svc.cluster.local/admin?replicaSet=rs0&ssl=false”
Login externally (outside the Kube cluster) it fails. I am following the instructions given at
What hostnames are you using to connect the MongoDB externally? And what error are you receiving? Have you created Istio gateway and the virtual service to reach the replicaset members?
Hello Vinodh,
I made some changes on the way I configured the deploy/cr.yaml file by sttig expose to true and type to LoadBalancer. That was not set before.
After that the connection fails (getaddrinfo EAI_AGAIN ) if I use : mongosh “mongodb://:x.y.z.t:27017,x.y.z.u:27017/admin?replicaSet=rs0&ssl=false"aSet=rs0&ssl=false”
Current Mongosh Log ID: 6a15d76b05ab523b499df8a2
Connecting to: mongodb://@10.0.0.2:27017,10.0.0.3:27017/admin?replicaSet=rs0&ssl=false&appName=mongosh+2.8.3
MongoServerSelectionError: getaddrinfo EAI_AGAIN -rs0-0.-rs0.psmdb.svc.cluster.local
However if I use directConnection and one IP address the login to mongodb works!
What do I need to do to use both IP addresses of Node 1 and Node 2?
Should I use directConnection?
mongosh “mongodb://:@x.y.z.t:27017/admin?directConnection=true&replicaSet=rs0&ssl=false”
Current Mongosh Log ID: 6a15d8bfe1d74bdee19df8a2
Connecting to: mongodb://@x.y.z.t:27017/admin?directConnection=true&replicaSet=rs0&ssl=false&appName=mongosh+2.8.3
Using MongoDB: 8.0.23-10
Using Mongosh: 2.8.3
The server generated these startup warnings when booting
2026-05-26T16:50:14.830+00:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem
2026-05-26T16:50:15.141+00:00: While invalid X509 certificates may be used to connect to this server, they will not be considered permissible for authentication
2026-05-26T16:50:15.141+00:00: For customers running the current memory allocator, we suggest changing the contents of the following sysfsFile
2026-05-26T16:50:15.141+00:00: For customers running the current memory allocator, we suggest changing the contents of the following sysfsFile
2026-05-26T16:50:15.141+00:00: We suggest setting the contents of sysfsFile to 0.