Can’t communicate between pods in Kubernetes

by admin
Reading Time: < 1 minute

I’m trying to connect two express apps to communicate with each other. Each app is deployed in a different Pod.
I’m trying to use a ClusterIP service to make a req from Pod 1 to Pod 2.

Say pod 1 has an‘http://pod-2-clusterip-service:4005’, data), and Pod 2 has ClusterIP service config that looks like this:

apiVersion: v1
kind: Service
  name: pod-2-clusterip-service
   app: pod2
    - name: pod2
      protocol: TCP
      port: 4005
      targetPort: 4005

Both pods seems to be up and running, when i do kubectl logs i can see that. Problem is, when I run this request from Pod 1 (through postman to NodePort service, i get:

            triggerUncaughtException(err, true /* fromPromise */);

<ref *1> Error: connect ECONNREFUSED
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16) {
  errno: -111,

And the app inside Pod 1 is crashing. Someone has an Idea what can it be?
I tried restarting the services and pods… didn’t help.

    Related Posts

    Leave a Comment