Kubernetes API-Server is throwing ECONNREFUSED

4/25/2018

I'm using this k8s javascript client library. For every 4th or 5th request its throwing ECONNREFUSED. I'm running k8s in AWS.

{ Error: connect ECONNREFUSED <master-node-external-ip>:443
    at Object._errnoException (util.js:1041:11)
    at _exceptionWithHostPort (util.js:1064:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1153:14)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: <master-node-external-ip>,
  port: 443 }

code

const k8s = require('@kubernetes/client-node');
const k8sApi = k8s.Config.defaultClient();
const pods = k8sApi.listNamespacedPod('default');

version

kube master node
kernelVersion: 4.4.78-k8s
kubeProxyVersion: v1.7.2
kubeletVersion: v1.7.2

I noticed that in AWS my master node was throwing

"RouteLimitExceeded: The maximum number of routes has been reached.

Can this be the issue for ECONNREFUSED?

-- sravis
kops
kubernetes

1 Answer

4/26/2018

"RouteLimitExceeded: The maximum number of routes has been reached.

This error means that you have too many routes in your AWS route table in VPC.

Here are limits from the official documentation:

  • Routes per route table (non-propagated routes) - 50. You can increase this limit up to a maximum of 100; however, network performance may be impacted

  • BGP advertised routes per route table (propagated routes) - 100. This limit cannot be increased.

Limits are set per routing table.

Can this be the issue for ECONNREFUSED?

Yes, this error can be the reason of the issue. When you have too many routes in the table, some routes can be missed in it, and it can make connections to the Kubernetes API unavailable.

-- Anton Kostenko
Source: StackOverflow