開發與維運

應用中心最佳實踐之—— Helm編排應用的多集群部署實戰

如果一個用戶賬號下有多個集群的情況,希望將一個應用同時發佈到多個集群裡面,並且不同集群環境有不同的參數,這裡就可以使用應用中心的多集群發佈功能。

添加多個目標集群

應用中心 -> 配置 -> 集群,將需要發佈的集群添加到應用中心內。這裡添加的集群需要kubeconfig,系統會自動讀取Kubernetes的配置。我們這裡一共添加了三個集群,第一個是本集群,另外的一個是北京區域的集群,還有一個是香港區域的集群。
1592817023181-7bf39d68-f556-4464-9ef1-829cd2439212.png

添加示例git repo

示例git repo地址: https://github.com/haoshuwei/appcenter-samples.git
編排模板路徑:examples/demo-helm
1.png
1.png

應用中心 -> 配置 -> 倉庫 -> 連接Repo

創建應用demo-helm-pre和demo-helm-pro
demo-helm-pre應用部署至目標集群ack-pre-beijing並指定使用values.yaml文件進行參數渲染
1.png

demo-helm-pro應用部署至目標集群ack-pre-hk並指定使用values-pro.yaml文件進行參數渲染
1.png

以下為2個應用創建參數配置對比

通用-應用名稱 demo-helm-pre demo-helm-pro
通用-部署策略 手動 手動
源-類型 Git Git
源-版本 https://github.com/haoshuwei/appcenter-samples.git https://github.com/haoshuwei/appcenter-samples.git
源-路徑 master master
目標集群-集群 examples/demo-helm examples/demo-helm
目標集群-命名空間 ack-pre-beijing ack-pro-hk
源-倉庫地址 demo-helm demo-helm
Helm-VALUES values.yaml values-pro.yaml

一鍵部署應用到多個集群

應用中心 -> 應用 -> 部署所有應用
1.png

勾選需要部署的demo-helm-pre和demo-helm-pro 2個應用並點擊部署
1.png

應用部署成功
1.png

Leave a Reply

Your email address will not be published. Required fields are marked *