微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

允许与kubernetes中的nginx进行群集内通信

我正面临着当前k8s设置的问题.在制作中,我提出了每个服务的三个副本并将它们放入一个pod中.当豆荚相互通话时,我们希望豆荚以循环方式与豆荚中的每个容器对话.不幸的是,由于TLS保持活跃状态​​,pod之间的连接永远不会终止 – 我们不希望特别更改该部分 – 但我们确实希望让容器中的每个容器正常通信.这就是我们现在拥有的:

How Services Talk

如果API试图与pod OSS交谈,它将仅与第一个容器通信.我希望API能够以循环方式与所有三个人交谈.

我该怎么做呢?我知道我需要一个Ingress控制器,比如@R_404_5171@.但是,是否有一些真正的教程打破了我如何实现这一目标?我不确定,对k8s有些新意.任何帮助都会被指定!

顺便说一句,我在minikube上本地工作.

编辑:

在生产中,我们提供每个服务的三个副本.当服务A需要与服务B通话时,选择来自服务B的pod B1并管理它接收的任何请求.然而,该pod B1成为来自服务B的唯一处理任何通信的pod;换句话说,豆荚B2和B3从不说话.我试图用@R_404_5171@来解决这个问题,因为看起来我们需要一个负载均衡器来帮助解决这个问题,但我不知道该怎么做.谁能提供一些有关需要做什么的详细解释?具体来说,我如何使用我的服务设置@R_404_5171@,以便所有pod都在服务中使用(以某种循环方式),这与现在只使用一个pod的情况不同?这是一个问题,因为在生产中,当我们有两个其他的pod在那里做任何事情时,一个pod会因请求而死,并且死亡.我正在minikube上进行本地开发.

解决方法:

我假设你的pod下面有一个微服务架构,对吗?您是否考虑过将Istio与Kubernetes一起使用?它由Google,IBM和Lyft开源和开发 – 旨在为开发人员提供一种与供应商无关的方式(这似乎是您正在寻找的),以便在云平台上连接,保护,管理和监控不同微服务的网络(AWS,Azure,Google等).

At a high level, Istio helps reduce the complexity of these
deployments, and eases the strain on your development teams. It is a
completely open source service mesh that layers transparently onto
existing distributed applications. It is also a platform, including
APIs that let it integrate into any logging platform, or telemetry or
policy system. Istio’s diverse feature set lets you successfully, and
efficiently, run a distributed microservice architecture, and provides
a uniform way to secure, connect, and monitor microservices.

这是link to Istio’s documentation,解释了如何详细设置多集群环境,这正是您要寻找的.

文档中有一条我想强调的注释 – 它可能与您的问题有关:

Since Kubernetes pods don’t have stable IPs, restart of any Istio
service pod in the control plane cluster will cause its endpoint to be
changed. Therefore, any connection made from remote clusters to that
endpoint will be broken. This is documented in Istio 07002.

There
are a number of ways to either avoid or resolve this scenario. This
section provides a high level overview of these options.

  • Update the DNS entries
  • Use a load balancer service type
  • Expose the Istio services via a gateway

我引用负载均衡器解决方案,因为它似乎是你想要的:

In Kubernetes, you can declare a service with a service type to be
LoadBalancer. A simple solution to the pod restart issue is to use
load balancers for the Istio services. You can then use the load
balancer IPs as the Istio services’s endpoint IPs to configure the
remote clusters.

我希望它有所帮助,如果你有任何疑问,请拍!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐