查看其它 1 个回答Garyy的回答

GaryyGaryy系统工程师某保险

请参考:https://developers.redhat.com/blog/2016/12/09/spring-cloud-for-microservices-compared-to-kubernetes/
这里面说明了spring cloud以及k8s的优缺点,希望对你有帮助。
Since both platforms are not directly comparable feature by feature, rather than digging into each item, here are the advantages and disadvantages of each platform summarised.

Spring Cloud

Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems such as configuration management, service discovery, circuit breakers, routing, etc. It is build on top of Netflix OSS libraries, written in Java, for Java developers.

Strengths

The unified programing model offered by the Spring Platform itself, and rapid application creation abilities of Spring Boot, give developers a great Microservice development experience. For example, with few annotations you can create a Config Server, and few more annotation you can get the client libraries configure your services.
There is a rich selection of libraries covering the majority of runtime concerns. And since all libraries are written in Java, it offers a multiple features, greater control and fine tuning options.
The different Spring Cloud libraries are well integrated with one another. For example a Feign client will also use Hystrix for Circuit Breaking, and Ribbon for load balancing the requests. Everything is annotation driven, easy to develop and feels like a heaven for Java developers.
Weaknesses

One of the major advantages of the Spring Cloud is also its drawback – it is limited to Java only. A strong motivation for the MSA is the ability to change technology stacks, libraries and even languages when required. That is not possible with Spring Cloud. If you want to consume Spring Cloud/Netflix OSS infrastructure services such as configuration management, service discovery, load balancing, the solution is not elegant. The Netflix Prana project implements the sidecar pattern to exposes Java based client libraries over HTTP to make it possible for applications written in Non-JVM languages exist in the NetflixOSS eco-system, but it is not very elegant. In addition, since I have written this article, Pivotal has announced a new cool project called SteelToe, which allows consuming Service Discovery and Config Server services from .Net clients too.
There is too much responsibility for Java developers to care about and the Java applications to handle. Each Microservice needs to run various clients for configuration retrieval, service discovery and load balancing. It is easy to set those up, but that doesn’t hide the build time a runtime dependencies to the environment. For example, I can create a Config Server with @EnableConfigServer annotation easily, but that is only the happy path. Every time I want to run a single Microservice, I need to have the Config Server up and running. For a controlled environment I have to think about making the Config Server highly available and since it can be backed by Git or Svn, I need shared file system for it. Similarly for service discovery I need to start Eureka Server first. For a controlled environment, I need to cluster it with multiple instances on each AZ, etc. It feels like as a Java developer I have to build and manage a not trivial Microservices platform in addition to implementing all the functional services.
Spring Cloud alone has a shorter scope in the Microservices journey, and you will also need to consider automated deployments, scheduling, resource management, process isolation, self healing, build pipelines, etc. for a complete Microservices experience. For this point, I think it is not fair to compare Spring Cloud alone to Kubernetes, and a more fair comparison would be between Spring Cloud + Cloud Foundry (or Docker Swarm) and Kubernetes. But that also means that for a complete end-to-end Microservices experience, Spring Cloud must be supplemented with something like Kubernetes itself.
Kubernetes

Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It is polyglot and provides primitives for provisioning, running, scaling and managing distributed systems.

Strengths

Kubernetes is a polyglot and generic container management platform that is capable of running both cloud native and traditional containerised applications. The services it provides such as configuration management, service discovery, load balancing, metrics collection, log aggregation are consumable by variety of languages. This allows having one platform in the organisation that can be used by multiple teams (including Java developers using Spring framework) and serve multiple purposes: application development, testing environments, build environments (to run source control system, build server, artifact repositories), etc.
When compared to Spring Cloud, Kubernetes addresses a wider set of MSA concerns. In addition to providing runtime services, Kubernetes also lets you provision environments, set resource constraints, RBAC, manage application lifecycle, enable autoscaling and self healing (behaving almost like an antifragile platform).
I cannot resist myself to mention that Kubernetes technology is based on Google’s 15 years of R&D and experience of managing containers. In addition, with close to 1000 committers, it is one of the most active Open Source communities on Github.
Weaknesses

Kubernetes is polyglot and as such its services and primitives are generic and not optimised for different platforms such as Spring Cloud for JVM. For example configurations are passed to applications as environment variables or amounted file system. It doesn’t have the fancy configuration updating capabilities offered by Spring Cloud Config.
Kubernetes is not a developer focused platform. It is intended to be used by DevOps minded IT personnel. As such, Java developers need to learn some new concepts and be open for learning new ways of solving problems. Despite it being super easy to start a developer instance of Kubernetes using MiniKube, there is a significant operation overhead to install a highly available Kubernetes cluster manually.
Kubernetes is still a relatively new platform (2 years old) and it is still actively developed and growing. Therefore there are many new features added with every release which may be difficult to keep up with. The good news is that, this has been envisaged, and the API is extensible and backward compatible.

保险 · 2018-07-13
浏览10726

回答者

Garyy
Garyy0410
系统工程师某保险
擅长领域: 云计算存储容器

Garyy 最近回答过的问题

回答状态

  • 发布时间:2018-07-13
  • 关注会员:3 人
  • 回答浏览:10726
  • X社区推广