Spring Cloud Config Server 与 Cloud kubernetes 的 ConfigMaps [英] Spring Cloud Config Server vs ConfigMaps for cloud kubernetes

查看:43
本文介绍了Spring Cloud Config Server 与 Cloud kubernetes 的 ConfigMaps的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们想利用 Spring Cloud Config Server 构建一个 Centralized Toggle Server,但我读过一篇博客/文章暗示 Spring Cloud Config 不适合 Kubernetes Cloud 环境(没有给出任何原因).相反,建议为此使用 Spring Kubernetes ConfigMaps.

We wanted to build a Centralized Toggle Server leveraging Spring Cloud Config Server, but I've read a blog/article hinting that Spring Cloud Config is not Suited for Kubernetes Cloud environment (didn't give any reason why). Instead it is recommended to use Spring Kubernetes ConfigMaps for that.

有人可以解释为什么不建议将 Spring Cloud Config Server 用于 Kubernetes 环境(如果有)?以及使用 Spring Kubernetes ConfigMaps 优于 Spring Cloud Config Server 的优势(如果有)?

Can some one shed the light on why Spring Cloud Config Server is not recommended for Kubernetes environment, if any? And advantages of using Spring Kubernetes ConfigMaps over Spring Cloud Config Server, if any?

推荐答案

这里有一些想法,一种可能有助于决定的比较:

Here are some thoughts, a kind of comparison that that might help to decide:

IMO 两者一般来说都可以工作.也许您的同事可以提供更多关于此的见解(我不是在开玩笑):如果您的特定环境中有一些特殊的东西会阻止 Spring Cloud 配置被视为一种选择.

IMO both can work generally speaking. Maybe you colleague could provide more insights on this (I'm not joking): what if there is something special in your particular environment that prevents Spring Cloud config from being even considered as an option.

  1. 一旦 spring cloud 配置中的属性发生变化,可以重新加载具有 @Refresh 范围的潜在 bean,而无需重新加载应用程序上下文.如果您使用 spring,您可能会从中受益的一种解决方案.

  1. Once the property changes in spring cloud config, potentially beans having @Refresh scope can be reloaded without the need to re-load the application context. A kind of solution that you might benefit from if you're using spring.

一般情况下,Spring Cloud Config 可以管理机密(如密码之类的东西),ConfigMaps 不能,在这种情况下你应该使用 kubernetes 的机密.

In general Spring Cloud Config can manage secrets (stuff like passwords), ConfigMaps can't, you should use Secrets of kubernetes in this case.

另一方面,Spring Cloud Config - 需要专门的服务.ConfigMaps 在 kubernetes 中是原生的".

On the other hand, Spring Cloud Config - requires a dedicated service. ConfigMaps is "native" in kubernetes.

当应用(一个业务)微服务启动时,它首先联系spring cloud config service,如果它不可用,应用将无法正常启动(从技术上来说,它会回退到spring boot支持的其他配置方式,如 application.properties 等)如果您有数百个微服务和数百个微服务实例,则 Cloud Config 必须始终可用,因此您可能需要这些的副本,其中当然是完全可行的.

When the application (a business) microservice starts it first contacts spring cloud config service, if its not available, the application won't start correctly (technically it falls back to other ways of configurations supported by spring boot, like application.properties, etc.) If you have hundreds of micro-services and hundreds of instances of microservice, Cloud Config has to be available all the time, so you might need a replica of those, which is perfectly doable of course.

如果您的所有微服务都使用 Java/Spring,则 Spring Cloud Config 效果最佳.ConfigMaps 是一种通用机制.话虽如此,spring cloud config 公开了 REST 接口,因此您可以进行集成.

Spring Cloud Config works best if all your microservices use Java / Spring. ConfigMaps is a general purpose mechanism. Having said that, spring cloud config exposes REST interface so you can integrate.

Spring Cloud Config 需要一些文件,这些文件可以位于文件系统或 git 存储库中.所以切换"实际上意味着 git commit 和 push.Kubernetes 通常用于后编译"环境,因此 git 甚至可能在那里不可用.

Spring Cloud Config requires some files that can be either on file system or on git repository. So the "toggle" actually means git commit and push. Kubernetes usually is used for "post-compile" environments so that its possible that git is not even available there.

DevOps 人员可能更习惯于使用 Kubernetes 工具,因为它是一种通用"解决方案.

DevOps people probably are more accustomed to use Kubernetes tools, because its a "general purpose" solution.

根据您的 CI 流程,一些见解可能来自 CI 人员(关于配置、环境变量应应用于 CI 工具等).这因应用程序而异,所以我相信您应该谈谈也给他们.

Depending on your CI process some insights might come from CI people (regarding the configuration, env. variables that should be applied on CI tool, etc.) This highly varies from application to application so I believe you should talk to them as well.

这篇关于Spring Cloud Config Server 与 Cloud kubernetes 的 ConfigMaps的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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