昨天非常快速的介绍了一下 Helm,了解了基础的安装与使用方式後,今天我们要试着用 Helm 来重新部署并安装我们的 Open-Match,试着感受一下,有使用 Helm 将 yaml 拆分为 template 与 value 的好处。
helm repo add open-match https://open-match.dev/chart/stable
helm install open-match --create-namespace --namespace open-match open-match/open-match \
--set open-match-customize.enabled=true \
--set open-match-customize.evaluator.enabled=true \
--set open-match-override.enabled=true \
--set query.replicas=1 \
--set frontend.replicas=1 \
--set backend.replicas=1
~ helm list -n open-match
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
open-match open-match 1 2021-09-26 21:16:24.437724 +0800 CST deployed open-match-1.2.0 1.2.0
~ kubectl get pods -n open-match
NAME READY STATUS RESTARTS AGE
open-match-backend-5bcfd664dd-pg5bx 1/1 Running 0 3m55s
open-match-evaluator-68b657c9d9-5w6qr 1/1 Running 0 3m55s
open-match-evaluator-68b657c9d9-8lrrn 1/1 Running 0 3m55s
open-match-evaluator-68b657c9d9-h9gsw 1/1 Running 0 3m55s
open-match-frontend-8478cb9d9b-cjmwx 1/1 Running 0 3m54s
open-match-query-8545bbb4d4-xzwkw 1/1 Running 0 3m54s
open-match-redis-node-0 3/3 Running 0 3m54s
open-match-redis-node-1 3/3 Running 0 3m42s
open-match-swaggerui-6658d4c55b-dphnl 1/1 Running 0 3m54s
open-match-synchronizer-85b5dc89d8-gwz4j 1/1 Running 0 3m54s
基本上当我们使用 Helm 进行安装的时候,我们使用的是 chart ,由於已经将 yaml 的部分参数拆分成模板与values,我们首先可以感受到最大的好处是,可以在部署时直接针对部分变数做调整,让我们看一下预设 value 档案的内容进行比较。
backend templates
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "openmatch.backend.hostName" . }}
namespace: {{ .Release.Namespace }}
annotations: {{- include "openmatch.chartmeta" . | nindent 4 }}
labels:
app: {{ template "openmatch.name" . }}
component: backend
release: {{ .Release.Name }}
spec:
replicas: {{ .Values.backend.replicas }}
values
backend: &backend
hostName:
grpcPort: 50505
httpPort: 51505
portType: ClusterIP
replicas: 3
image: openmatch-backend
首先原本我们可能在不同环境,需要部署不一样数量的的 pods 时,需要准备多份或异动 yaml ,现在可以透过准备抽好的 values ,方便管理不同环境的差异,这就是模板化的好处,整个部署设定档化,一目了然方便管理。其次透过 Helm cli tool 提供的功能,我可以在部署的时候,以 —set
来调整模板预先抽好的变数名称内容。
同样利用 helm 来改变我们的部署规模,将 open-match-query 调整为 2
helm upgrade open-match --namespace open-match open-match/open-match \
--set open-match-customize.enabled=true \
--set open-match-customize.evaluator.enabled=true \
--set open-match-override.enabled=true \
--set query.replicas=2 \
--set frontend.replicas=1 \
--set backend.replicas=1
Result
~ kubectl get pods -n open-match
NAME READY STATUS RESTARTS AGE
open-match-backend-5bcfd664dd-pg5bx 1/1 Running 0 35m
open-match-evaluator-68b657c9d9-5w6qr 1/1 Running 0 35m
open-match-evaluator-68b657c9d9-8lrrn 1/1 Running 0 35m
open-match-evaluator-68b657c9d9-h9gsw 1/1 Running 0 35m
open-match-frontend-8478cb9d9b-cjmwx 1/1 Running 0 35m
open-match-query-8545bbb4d4-74sfx 1/1 Running 0 26s
open-match-query-8545bbb4d4-xzwkw 1/1 Running 0 35m
open-match-redis-node-0 3/3 Running 0 35m
open-match-redis-node-1 3/3 Running 0 34m
open-match-swaggerui-6658d4c55b-dphnl 1/1 Running 0 35m
open-match-synchronizer-85b5dc89d8-gwz4j 1/1 Running 0 35m
异动监控
REVISION 基於我们的调整改为 2,最後异动时间也同样显示於资讯中
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
open-match open-match 2 2021-09-26 21:51:00.68284 +0800 CST deployed open-match-1.2.0 1.2.0
>>: Proxmox VE 虚拟机 Cloud-Init 应用
前一篇的「YAML格式以外的Pipeline传统编辑器(Classic Editor)」文章内容中看...
上次介绍完前面两个修饰符,今天就来把它学习完吧!!! .stop .prevent .capture...
Imagemap message Imagemap messages are messages co...
假设今天有的flask服务要附上能一起使用的DB,可以考虑使用Docker compose这个服务。...
今天写广度优先搜寻(BFS),BFS是一种图形搜寻演算法,在解题的时候会用来爆搜的其中一种方法 直接...