領先一步
VMware 提供培訓和認證,助您加速發展。
瞭解更多Spring Cloud Kubernetes 提供了知名 Spring Cloud 介面的實現,允許開發者在 Kubernetes 上構建和執行 Spring Cloud 應用。雖然這個專案在構建雲原生應用時可能對您有用,但它並不是在 Kubernetes 上部署 Spring Boot 應用的必需條件。如果您剛開始在 Kubernetes 上執行 Spring Boot 應用,僅使用基本的 Spring Boot 應用和 Kubernetes 本身就可以實現很多功能。要了解更多資訊,您可以從閱讀部署 Spring Boot 到 Kubernetes 的參考文件和學習Spring 和 Kubernetes 研討會材料入手。
Kubernetes 感知
DiscoveryClient
實現
透過 ConfigMaps 配置的 PropertySource
物件
透過 Netflix Ribbon 實現客戶端負載均衡
最簡單的入門方法是引入 Spring Cloud BOM,然後將 spring-cloud-starter-kubernetes-all
新增到您應用的 classpath 中。如果您不想包含 Spring Cloud Kubernetes 的所有功能,可以為您需要的功能單獨新增對應的 Starter。預設情況下,當 Spring Cloud Kubernetes 檢測到它在 Kubernetes 叢集中執行時,會啟用 kubernetes
profile。您可以利用此特性,透過建立 kubernetes-application
配置檔案來配置任何與 Kubernetes 相關的內容。一旦 Starter 位於 classpath 中,該應用的行為應與任何其他 Spring Cloud 應用一樣。