简体   繁体   English

Docker 容器中的微服务

[英]Microservices in Docker Container

I am using Spring Cloud for Creating Microservice Architecture.我正在使用 Spring Cloud 来创建微服务架构。

I was using the below feature from the Spring Cloud我正在使用 Spring Cloud 中的以下功能

  • Zuul – API gateway service that provides dynamic routing, monitoring, resiliency, security, and more - Zuul – 提供动态路由、监控、弹性、安全性等的 API 网关服务 -
  • Ribbon – Client side load balancer功能区 - 客户端负载均衡器
  • Feign – Declarative REST client Feign - 声明式 REST 客户端
  • Eureka – Service registration and discovery Eureka – 服务注册和发现
  • Sleuth – Distributed tracing via logs Sleuth – 通过日志进行分布式跟踪
  • Zipkin – Distributed tracing system with request visualization. Zipkin – 具有请求可视化的分布式跟踪系统。
  • Hystrix - Circuit Breaker, Fault Tolerance, Hystrix Dashboard for all API Hystrix - 适用于所有 API 的断路器、容错、Hystrix 仪表板

Now Lets say if I have 100 microservices, then we need 100 servers to maintain each microservices.现在假设我有 100 个微服务,那么我们需要 100 台服务器来维护每个微服务。 So I thought of using Kubernetes to solve this issue by deploying each microservices in a separate docker container, so now since Kubernetes takes care of microserivice health check, autoscaling, load-balancing so do I need to again use Ribbon, Eureka and Zuul.所以我想通过将每个微服务部署在一个单独的 docker 容器中来使用 Kubernetes 来解决这个问题,所以现在既然 Kubernetes 负责微服务健康检查、自动缩放、负载平衡,所以我需要再次使用 Ribbon、Eureka 和 Zuul。

Can anyone please help me on this任何人都可以帮我解决这个问题吗

Even when you use Spring Cloud, 100 services do NOT mean 100 servers.即使您使用 Spring Cloud,100 个服务并不意味着 100 个服务器。 In Spring Cloud the packaging unit is Spring Boot application and a single server may host many such Spring Boot applications.在 Spring Cloud 中,打包单元是 Spring Boot 应用程序,单个服务器可以托管许多这样的 Spring Boot 应用程序。 If you want, you can containerize the Spring Boot applications and other Spring Cloud infrastructure support components.如果需要,您可以将 Spring Boot 应用程序和其他 Spring Cloud 基础设施支持组件容器化。 But that is not Kubernetes.但这不是 Kubernetes。

If you move to Kubernetes, you don't need the infrastructure support services like Zuul, Ribbon etc. because Kubernetes has its own components for service discovery, gateway, load balancer etc. In Kubernetes, the packaging unit is Docker images and one or more Docker containers can be put inside one pod which is the minimal scaling unit.如果迁移到 Kubernetes,则不需要 Zuul、Ribbon 等基础设施支持服务,因为 Kubernetes 有自己的组件用于服务发现、网关、负载均衡器等。在 Kubernetes 中,打包单元是 Docker 镜像和一个或多个Docker 容器可以放在一个 pod 中,这是最小的扩展单元。 So, Kubernetes has a different set of components to manage the Microservices.因此,Kubernetes 有一组不同的组件来管理微服务。

Kubernetes is a different platform than Spring cloud. Kubernetes 是一个不同于 Spring Cloud 的平台。 Both have the same objectives.两者都有相同的目标。 However, Kubernetes has some additional features like self healing, auto-scaling, rolling updates, compute resource management, deployments etc.然而,Kubernetes 有一些额外的功能,比如自我修复、自动扩展、滚动更新、计算资源管理、部署等。

只是为了添加 saptarshi basu 的回答,您可能需要查看https://dzone.com/articles/deploying-microservices-spring-cloud-vs-kubernetes,因为它会进行比较并询问您可能想要承担哪些责任在 Kubernetes 上使用 Spring Cloud 时由哪些组件处理

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM