Kubernetes frequent connection refused error between two nodejs docker containers

4/4/2019

I am getting connection refused error frequently on kubernetes. I have two nodejs-docker servers running in kubernetes. If I try to curl from one container to another sometimes I get following logs

curl: (7) Failed to connect to testnode port 3000: Connection refused
curl: (7) Failed to connect to testnode port 3000: Connection refused
curl http://testnode :3000
<!DOCTYPE html><html><head><title>Express</title><link rel="stylesheet" href="/stylesheets/style.css"></head><body><h1>Express</h1><p>Welcome to Express</p></body></html>root@deployment-zaoui-5c6988d474-nzltd:/usr/src/app
curl: (7) Failed to connect to testnode port 3000: Connection refused

If I try curl localhost:3000 in the same docker container it works. There is something problem while connecting from another container. It works on regular docker networks. This problem only occurs inside kubernetes. Needs experts advise to find the solutions. Thanks in advance.

-- Siby Augustine
docker
kubernetes
node.js

0 Answers