Kubernetes中的跨集群通信 [英] Cross cluster communication in Kubernetes
问题描述
我在 AWS EKS 中运行着两个kubernetes集群.如何将它们都连接起来,以便两者都可以通信和共享数据?
I have two kubernetes clusters running inside AWS EKS. How can I connect them both so that both can communicate and share data ?
在一个集群上,只有无状态应用程序正在运行,而在另一个有状态的应用程序(如 Redis DB , RabbitMQ 等)上运行.
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 ?
推荐答案
如果您有特定的集群来运行数据库和其他私有有状态的工作负载,则请确保该EKS集群的工作节点是私有的.
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.
下一步将是创建服务资源,以使用内部端点公开您的Redis数据库.您可以通过指定以下内容来实现它:
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"
使用上述方法,您将使用内部端点公开整个群集和有状态的工作负载.完成此操作后,您有两种选择来连接VPC.
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.
- VPC对等以允许一个群集与另一个群集连接.
- 两个VPC用来私下通信的Transit Gateway.
这篇关于Kubernetes中的跨集群通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!