I got error like this , need help

First I gonna apologize with my bad English. So I just use mongo atlas for first time, My app is use k8s and I connect to mongo with query string that Mongo atlas provide to me , After connect I got error like this

panic: server selection error: context deadline exceeded, current topology: { Type: ReplicaSetNoPrimary, Servers: [{ Addr: URL:27017, Type: Unknown, Last error: connection() error occurred during connection handshake: dial tcp 192.168.248.2:27017: i/o timeout }, { Addr: URL:27017, Type: Unknown, Last error: connection() error occurred during connection handshake: dial tcp 192.168.248.3:27017: i/o timeout }, { Addr: URL:27017, Type: Unknown, Last error: connection() error occurred during connection handshake: dial tcp 192.168.248.4:27017: i/o timeout }, ] }

and when I check with in access history It’s show like this
Screen Shot 2565-10-22 at 13.43.34

If you are able to connect i think you can ignore those messages
Atlas does not support SCRA-SHA-256
Check this thread

2 Likes

I believe the failed SCRAM-SHA-256 authentication is unrelated to the error you’re seeing from your application.

The error message

error occurred during connection handshake: dial tcp 192.168.248.4:27017: i/o timeout

suggests that your application failed to connect to the MongoDB cluster in Atlas due to a timeout.

A few questions:

  1. Is your k8s cluster included in the IP access list for your Atlas cluster?
  2. Is your Go Driver ConnectTimeout value high enough? Note the default is 30 seconds, which works for most applications.
2 Likes