Comments (7)
So today I've tried to isolate the issue by creating a minimal reproduction. It turned out, that everything works fine.
Honestly, I don't know where the issue was, but now it works 🤣
You can check it out here: https://github.com/flolu/mongodb-k8s-connection
from mongodb-kubernetes-operator.
@StMarian Yes. I've deployed it into the mongodb namespace, but nevertheless I get the error mentioned above.
from mongodb-kubernetes-operator.
I think the problem is in your connection string:
mongodb://event-store-svc.mongodb.svc.cluster.local:27017 - this is the format of the connection string to the single instance of mongodb
if you want to connect to the replicaset, your connection string should look like this:
mongodb://event-store-0.event-store-svc.mongodb.svc.cluster.local:27017,event-store-1.event-store-svc.mongodb.svc.cluster.local:27017/?replicaSet=event-store
source: https://docs.mongodb.com/manual/reference/connection-string/#replica-set-option
k8s pod dns name: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#a-aaaa-records-1
from mongodb-kubernetes-operator.
@StMarian I've tried the new connection string, but unfortunately, I still get this error:
MongoServerSelectionError: connect ECONNREFUSED 10.1.74.34:27017
at Timeout._onTimeout (node_modules/mongodb/lib/core/sdam/topology.js:430:30)
at listOnTimeout (internal/timers.js:531:17)
at processTimers (internal/timers.js:475:7)
Do you have any other idea, what might be the reason for this error?
from mongodb-kubernetes-operator.
@StMarian I also face the same issue.
I tried with
mongodb://example-mongodb-0.example-mongodb-svc.mongodb.svc.cluster.local:27017,example-mongodb-1.example-mongodb-svc.mongodb.svc.cluster.local:27017/?replicaSet=example-mongodb
Error log:
node:1) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [example-mongodb-1.example-mongodb-svc.mongodb.svc.cluster.local:27017] on first connect [Error: getaddrinfo ENOTFOUND example-mongodb-1.example-mongodb-svc.mongodb.svc.cluster.local at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:26) { name: 'MongoNetworkError', [Symbol(mongoErrorContextSymbol)]: {} }] at Pool.<anonymous> (/app/node_modules/mongodb/lib/core/topologies/server.js:433:11) at Pool.emit (events.js:315:20) at /app/node_modules/mongodb/lib/core/connection/pool.js:577:14 at /app/node_modules/mongodb/lib/core/connection/pool.js:1021:9 at /app/node_modules/mongodb/lib/core/connection/connect.js:31:7 at callback (/app/node_modules/mongodb/lib/core/connection/connect.js:247:5) at Socket.<anonymous> (/app/node_modules/mongodb/lib/core/connection/connect.js:276:7) at Object.onceWrapper (events.js:422:26) at Socket.emit (events.js:315:20) at emitErrorNT (internal/streams/destroy.js:84:8)
from mongodb-kubernetes-operator.
@flolu, @jamesbroadhead the connection string that I provided assumes that the mongodb is deployed to the mongodb namespace. If this is not true, you will need to update the connection string and use the correct namespace:
mongodb://event-store-0.event-store-svc.mongodb.svc.cluster.local:27017,event-store-1.event-store-svc.mongodb.svc.cluster.local:27017/?replicaSet=event-store
from mongodb-kubernetes-operator.
I guess the issue is with the connection string. Hope this can be documented in the readme file. Thanks in advance.
from mongodb-kubernetes-operator.
Related Issues (20)
- Mongodb-agent is never ready - HOT 7
- Readiness probe failed: command "/opt/scripts/readinessprobe" timed out on DB Pod when installing on Mac M1, even when using arm64 images HOT 9
- Mongodb Operator v0.8.3 crash on aarch64 k8s workers HOT 1
- Current mongo db members is 0 though >0 configured and running HOT 6
- Logging solely to stdout/stderr at the specified log level HOT 9
- It is not possible to pass unique labels and selectors on arbiter and mongo members. HOT 4
- Is it possible to pass resources limits and requests on initContainers? HOT 2
- ReplicaSet stuck in Pending phase via MongoDB Community Operator HOT 25
- How to schedule replicas and persistent volume in different availability zones HOT 6
- Steps to upgrade from 4.4 to 6.0 via 5.0? HOT 5
- Unable to connect to MongoDB (not authorized on admin to execute command) HOT 3
- Mongodb-agent container is not comming into ready state - HOT 7
- MongoDB Operator fails to identify caCertificateSecretRef HOT 2
- MongoDB 7.0 support HOT 2
- Deployment only works in the same namespace where the operator was installed HOT 5
- Compatibility: MongoDB Kubernetes Operator v0.9 with Rocky Linux HOT 2
- mongodb-agent never gets ready HOT 5
- Unable to scrape prometheus metrics via opentelemetry-collector HOT 2
- Allow service spec to be updated from MongoDBCommunity CR HOT 3
- [Feature Request] Enable Copying/Annotation of Generated Secrets to Additional Namespaces HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongodb-kubernetes-operator.