Harsh Manvar
Harsh Manvar

Reputation: 30083

Cross cluster communication in Kubernetes

I have two kubernetes clusters running inside AWS EKS. How can I connect them both so that both can communicate and share data ?

On one cluster only stateless applications are running while on another stateful like Redis DB, RabbitMQ etc.

Which will be the easiest way to setup communication ?

Upvotes: 0

Views: 1614

Answers (2)

Harsh Manvar
Harsh Manvar

Reputation: 30083

I will be following the suggested approach by @marcincuber to use internal load balancer.

However, I also got one another workaround exposing the Redis, RabbitMQ service type as LoadBalancer.

Since my both cluster in the same VPC there is no need of VPC peering or any gateway setup, I am thinking to restrict the traffic via using Kubernetes default service loadBalancerSourceRanges.

Upvotes: 0

marcincuber
marcincuber

Reputation: 3791

If you have a specific cluster to run DBs and other private stateful workloads, then ensure that your worker nodes for that EKS cluster are private.

Next step would be to create service resource to expose your Redis DB with an internal endpoint. You can achieve it by specifying following:

annotations:
    service.beta.kubernetes.io/aws-load-balancer-internal: "true"

With the above you are going to have entire cluster and stateful workloads exposed using internal endpoints. Once this is done, you have two options to connect your VPCs.

  1. VPC peering to allow one cluster to connect with the other.
  2. Transit Gateway which two VPCs will use to communicate privately.

Upvotes: 3

Related Questions