Cross cluster communication in Kubernetes

只谈情不闲聊 提交于 2021-01-29 12:13:31

问题


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 ?


回答1:


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.



回答2:


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.



来源:https://stackoverflow.com/questions/60038177/cross-cluster-communication-in-kubernetes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!