-1

I'm new with docker, i got this error i'm using AMZ platform with mongoDB and graphql with Docker everything was working fine cause i didn't wright all the code, and boum i constantly get running and CrashLoopBackOff all the times :( i don't know whyyyy ! This is what I getting:

enter code here
NAME                       READY   STATUS             RESTARTS   AGE
graphql-xxxxxxxxxx-xxxxx   0/1     CrashLoopBackOff   8          12m
graphql-xxxxxxxxxx-xxxxx   0/1     CrashLoopBackOff   7          11m

The output from 'kubectl describe pod graphql-xxxxxxxxxx-xxxxx':

Warning  Unhealthy  11m (x9 over 12m)      kubelet, pool-g1r6uxpbs-a1jl  Liveness probe failed: Get https://10.244.0.5:4000/healthz: dial tcp 10.244.0.5:4000: connect: connection refused
 Warning  BackOff    3m22s (x24 over 9m3s)  kubelet, pool-g1r6uxpbs-a1jl  Back-off restarting failed container

Yes i double check my whitelisted and add me with my current IP. The output from 'kubectl describe logs graphql-xxxxxxxxxx-xxxxx':

{"message":"Starting server with args []...","level":"info"}
{"message":"External IP 167.172.52.238","level":"info"}
{"message":"connection error:Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/","reason":{"type":"ReplicaSetNoPrimary","setName":null,"maxSetVersion":null,"maxElectionId":null,"servers":{},"stale":false,"compatible":true,"compatibilityError":null,"logicalSessionTimeoutMinutes":null,"heartbeatFrequencyMS":10000,"localThresholdMS":15,"commonWireVersion":null},"level":"error","stack":"MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/\n    at NativeConnection.Connection.openUri (/home/graphql/node_modules/mongoose/lib/connection.js:826:32)\n    at Mongoose.connect (/home/graphql/node_modules/mongoose/lib/index.js:335:15)\n    at Object.connect (/home/graphql/db/mongo.js:26:33)\n    at Object.<anonymous> (/home/graphql/index.js:83:44)\n    at Module._compile (internal/modules/cjs/loader.js:778:30)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)\n    at Module.load (internal/modules/cjs/loader.js:653:32)\n    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)\n    at Function.Module._load (internal/modules/cjs/loader.js:585:3)\n    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)\n    at startup (internal/bootstrap/node.js:283:19)\n    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)"}

Please if someone can give me a away to debug more this error or i dunno...

Jonas Kabalo
  • 1
  • 1
  • 1
  • 7

1 Answers1

0

The error getaddrinfo EAI_AGAIN suggests that your docker environment is unable to reach the internet. Hence the call to an external API is failing.

A simple fix is to create the file /etc/docker/daemon.json

and insert:

{
    "dns": ["10.0.0.2", "8.8.8.8"]
}

where 10.0.0.2 is the first DNS server your machine requests records from, and 8.8.8.8 is the fallback DNS server, google in this case.

Dhruv Shah
  • 1,611
  • 1
  • 8
  • 22
  • Thx a lot to take time to reply ! i did create the daemon.json but now i got a diferent error (i update the question) witch seems really strange to me cause everything is fine on MongoDB. Do you got any idea why ? – Jonas Kabalo Jun 24 '20 at 13:11
  • The new error suggests that your docker daemon was able to reach the internet and reach upto your MongoDB Atlas Server. However, as per the latest error that you have shared it seems like an issue with IP Whitelisting on the Mongo Atlas Server side. Try whitelisting your IP address under Clusters -> Security -> IP Whitelist in MiongoDb Atlas Server. You can find your IP by a simple google search 'what is my ip' – Dhruv Shah Jun 24 '20 at 13:20
  • I did it, but nothing change and i got the same error, looks like the docker don't update what i'm doing on mongoDB and i'm running on the good port aswell, i really don't know what could be the error.... – Jonas Kabalo Jun 24 '20 at 13:40
  • It would helpful if you can share the yaml configs that you are using for deploying the graphql application. It seems like an issue with the MongoDB Atlas server details. However, your initial issue of not being able to access the internet through your docker daemon is resolved. Please accept the answer and post a different question for the connection issue with MongoDB Atlas server through your graphql application. – Dhruv Shah Jun 24 '20 at 14:40
  • it's done, i make another question and thank you to take time for that i appreciate a lot !! – Jonas Kabalo Jun 24 '20 at 15:09