Examples
此方法包括将依赖项 spring-cloud-kubernetes-discovery 和 spring-cloud-kubernetes-config 添加到类路径中,并删除其他服务发现或配置客户端依赖项。
示例项目演示了如何使用这些依赖项,使应用程序能够从任何 Spring Boot 应用程序中利用 Kubernetes 服务。
Spring Cloud Kubernetes 试图使你的应用程序通过遵循 Spring Cloud 接口来使用 Kubernetes 原生服务变得透明。
Spring Cloud Kubernetes tries to make it transparent for your applications to consume Kubernetes Native Services by following the Spring Cloud interfaces.
在你的应用程序中,你需要将 spring-cloud-kubernetes-discovery
依赖项添加到你的类路径,并移除包含 DiscoveryClient
实现的任何其他依赖项(即 Eureka Discovery 客户端)。PropertySourceLocator
也适用,你需要将 spring-cloud-kubernetes-config
添加到类路径,并移除包含 PropertySourceLocator
实现的任何其他依赖项(即配置服务器客户端)。
In your applications, you need to add the spring-cloud-kubernetes-discovery
dependency to your classpath and remove any other dependency that contains a DiscoveryClient
implementation (that is, a Eureka discovery client).
The same applies for PropertySourceLocator
, where you need to add to the classpath the spring-cloud-kubernetes-config
and remove any other dependency that contains a PropertySourceLocator
implementation (that is, a configuration server client).
以下项目重点介绍了这些依赖项的使用,并演示了如何从任何 Spring Boot 应用程序使用这些库:
The following projects highlight the usage of these dependencies and demonstrate how you can use these libraries from any Spring Boot application:
-
Spring Cloud Kubernetes Examples: the ones located inside this repository.
-
Spring Cloud Kubernetes Full Example: Minions and Boss
-
Spring Cloud Kubernetes Full Example: SpringOne Platform Tickets Service
-
Spring Cloud Gateway with Spring Cloud Kubernetes Discovery and Config
-
Spring Boot Admin with Spring Cloud Kubernetes Discovery and Config