Spring Cloud和编排工具(如Docker Swarm和Kubernetes)的组合 [英] Combination of Spring Cloud and Orchestration Tools Like Docker Swarm and Kubernetes

查看:100
本文介绍了Spring Cloud和编排工具(如Docker Swarm和Kubernetes)的组合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个云原生应用程序,它是使用Spring Cloud Netflix实现的.

I have a cloud-native application, which is implemented using Spring Cloud Netflix.

因此,在我的应用程序中,我正在使用Eureka服务发现来管理应用程序不同服务的所有实例.当每个服务实例都想与另一个服务实例对话时,它使用Eureka来获取有关目标服务的必需信息(例如IP和端口).

So, in my application, I'm using Eureka service discovery to manage all instances of different services of the application. When each service instance wants to talk to another one, it uses Eureka to fetch the required information about the target service (IP and port for example).

也可以使用Docker SwarmKubernetes之类的工具来实现服务编排,并且看起来Eureka的作用与Docker SwarmKubernetes的作用之间存在一些重叠.

The service orchestration can also be achieved using tools like Docker Swarm and Kubernetes, and it looks there are some overlaps between what Eureka does and what Docker Swarm and Kubernetes can do.

例如,假设我在Docker Swarm中创建了具有5个实例的服务.因此,群集确保了这5个实例始终处于运行状态.另外,应用程序的每个服务都在内部向Eureka发送定期心跳,以表明它仍然有效.似乎我们在这里有两层健康检查,一层用于Docker,另一层在Spring Cloud本身内部.

For example, Imagine I create a service in Docker Swarm with 5 instances. So, swarm insures that those 5 instances are always up and running. Additionally, each services of the application is sending a periodic heartbeat to the Eureka internally, to show that it's still alive. It seems we have two layers of health check here, one for Docker and another inside the Spring Cloud itself.

例如,您可以在整个集群中公开用于服务的端口,这消除了进行服务发现的某些需求(端口始终是显而易见的).另一个示例可能是docker内部routing mesh执行的负载平衡,而Ribbon组件或Eureka本身在内部进行了负载平衡.在这种情况下,拥有硬件负载平衡器可以使我们获得三层负载平衡功能.

Or for example, you can expose a port for a service across the entire swarm, which eliminates some of the needs to have a service discovery (the ports are always apparent). Another example could be load balancing performed by the routing mesh inside the docker, and the load balancing happening internally by Ribbon component or Eureka itself. In this case, having a hardware load balancer, leads us to a 3-layered load balancing functionality.

因此,我想知道一起使用这些工具是否合理?看来,结合使用这些技术会大大增加应用程序的复杂性,并且可能是多余的.

So, I want to know is it rational to use these tools together? It seems using a combination of these technologies increases the complexity of the application very much and may be redundant.

感谢您的阅读!

推荐答案

是的,您是正确的.我们在Oracle云平台和Predix Cloud Foundry上部署了类似的Spring Cloud Netflix应用程序.如果您使用多个Kubernetes集群,则必须使用功能区负载平衡,因为您有多个服务实例.

Yes, you are correct. We have a similar Spring Cloud Netflix application deployed on Oracle cloud platform and Predix Cloud Foundry. If you use multiple Kubernetes clusters then you have to use Ribbon load balancing because you have multiple instance for services.

我无法告诉您KubernetesDocker Swarm哪个更好.我们使用Kubernetes进行服务编排,因为它提供了更大的灵活性.

I cannot tell you which is better Kubernetes or Docker Swarm. We use Kubernetes for service orchestration as it provides more flexibility.

这篇关于Spring Cloud和编排工具(如Docker Swarm和Kubernetes)的组合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆