Graylog not working

Hi, I’m using Graylog 4.2 deployed on a kubernetes cluster and a mongodb 4.2. Graylog shows the following errors and I don’t know what the reason is.

2022-09-13 08:06:01,513 INFO    [cluster] - No server chosen by com.mongodb.client.internal.MongoClientDelegate$1@5d93ff21 from cluster description ClusterDescription{type=REPLICA_SET, connectionMode=MULTIPLE, serverDescriptions=[ServerDescription{address=mongodb-svc.xxxxxxxx.svc.cluster.local:27017, type=UNKNOWN, state=CONNECTING}]}. Waiting for 30000 ms before timing out - {}
2022-09-13 08:06:01,588 INFO    [cluster] - Exception in monitor thread while connecting to server mongodb-svc.xxxxxxx.svc.cluster.local:27017 - {}
com.mongodb.MongoSocketOpenException: Exception opening socket
        at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70) ~[graylog.jar:?]
        at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:128) ~[graylog.jar:?]
        at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117) [graylog.jar:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_312]
Caused by: java.net.ConnectException: Connection refused (Connection refused)
        at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:1.8.0_312]
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:1.8.0_312]
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:1.8.0_312]
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:1.8.0_312]
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:1.8.0_312]
        at java.net.Socket.connect(Socket.java:607) ~[?:1.8.0_312]
        at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:64) ~[graylog.jar:?]
        at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:79) ~[graylog.jar:?]
        at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:65) ~[graylog.jar:?]
        ... 3 more
2022-09-13 08:06:31,514 ERROR   [MongoConnectionProvider] - Error connecting to MongoDB: Timed out after 30000 ms while waiting for a server that matches com.mongodb.client.internal.MongoClientDelegate$1@5d93ff21. Client view of cluster state is {type=REPLICA_SET, servers=[{address=mongodb-svc.xxxxxx.svc.cluster.local:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}] - {}
2022-09-13 08:06:31,523 INFO    [cluster] - No server chosen by com.mongodb.client.internal.MongoClientDelegate$1@25f14e93 from cluster description ClusterDescription{type=REPLICA_SET, connectionMode=MULTIPLE, serverDescriptions=[ServerDescription{address=mongodb-svc.xxxxxxxx.svc.cluster.local:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]}. Waiting for 30000 ms before timing out - {}
2022-09-13 08:07:01,584 INFO    [cluster] - No server chosen by com.mongodb.client.internal.MongoClientDelegate$1@3d8bd881 from cluster description ClusterDescription{type=REPLICA_SET, connectionMode=MULTIPLE, serverDescriptions=[ServerDescription{address=mongodb-svc.xxxxxxxxs.svc.cluster.local:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]}. Waiting for 30000 ms before timing out - {}

Hello,

Looks like you have a connection error to MongoDb.

Error connecting to MongoDB: Timed out after 30000

Check firewalls and network configurations would be my first step.