From a1b73ec81a9594ebf1741493e775fea1f5f6ded0 Mon Sep 17 00:00:00 2001 From: Kagaya Date: Mon, 25 Aug 2025 23:27:17 +0800 Subject: [PATCH] doc: enable ha mode Signed-off-by: Kagaya --- .../current/installation.md | 38 +++++++++++++++++ kruisegame/installation.md | 41 +++++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/i18n/zh/docusaurus-plugin-content-docs-kruisegame/current/installation.md b/i18n/zh/docusaurus-plugin-content-docs-kruisegame/current/installation.md index d63357fbe2..6ceea6bc76 100644 --- a/i18n/zh/docusaurus-plugin-content-docs-kruisegame/current/installation.md +++ b/i18n/zh/docusaurus-plugin-content-docs-kruisegame/current/installation.md @@ -47,6 +47,7 @@ $ helm upgrade kruise-game openkruise/kruise-game --version 1.0.0 [--force] | `kruiseGame.webhook.targetPort` | 用于 MutatingWebhookConfigurations 中工作负载的 ObjectSelector | `9876` | | `kruiseGame.apiServerQps` | kruise-game-controller-manager 每秒发送到 API server的最大持续查询数 | `5` | | `kruiseGame.apiServerQpsBurst` | kruise-game-controller-manager 每秒发送到 API server的最大突发查询数 | `10` | +| `kruiseGame.leaderElection` | 是否开启 leader-election 功能以支持高可用部署 | `false` | | `replicaCount` | kruise-game 的期望副本数 | `1` | | `image.repository` | kruise-game 的镜像仓库 | `openkruise/kruise-game-manager` | | `image.tag` | kruise-game 的镜像版本 | `v0.10.0` | @@ -87,6 +88,43 @@ $ helm upgrade kruise-game openkruise/kruise-game --version 1.0.0 [--force] $ helm install kruise-game https://... --set image.repository=registry-cn-hangzhou.ack.aliyuncs.com/acs/kruise-game-manager ``` +#### 可选:使用高可用部署 + +如果你想要使用高可用部署,需要配置使用certManager托管证书,并开启leader-election和设置 `replicaCount` 大于等于3,例如: + +```bash +$ helm install kruise-game openkruise/kruise-game \ + --set replicaCount=3 \ + --set certificates.autoGenerated=false \ + --set certificates.certManager.enabled=true \ + --set kruiseGame.leaderElection=true +``` + +如果需要升级已有的部署,可以参考使用如下命令: + +```bash +# 使用helm纳管webhook, helm <= v3.16> +$ kubectl label mutatingwebhookconfiguration kruise-game-mutating-webhook app.kubernetes.io/managed-by=Helm +$ kubectl annotate mutatingwebhookconfiguration kruise-game-mutating-webhook meta.helm.sh/release-name=kruise-game +$ kubectl annotate mutatingwebhookconfiguration kruise-game-mutating-webhook meta.helm.sh/release-namespace=default +$ kubectl label validatingwebhookconfiguration kruise-game-validating-webhook app.kubernetes.io/managed-by=Helm +$ kubectl annotate validatingwebhookconfiguration kruise-game-validating-webhook meta.helm.sh/release-name=kruise-game +$ kubectl annotate validatingwebhookconfiguration kruise-game-validating-webhook meta.helm.sh/release-namespace=default + +$ helm upgrade kruise-game openkruise/kruise-game \ + --set replicaCount=3 \ + --set certificates.autoGenerated=false \ + --set certificates.certManager.enabled=true \ + --set kruiseGame.leaderElection=true + +# helm > v3.17, 可直接使用 --take-ownership 参数 +$ helm upgrade kruise-game openkruise/kruise-game --take-ownership \ + --set replicaCount=3 \ + --set certificates.autoGenerated=false \ + --set certificates.certManager.enabled=true \ + --set kruiseGame.leaderElection=true +``` + ## 卸载OpenKruiseGame(OKG) 请注意,这将导致删除 kruise-game 创建的所有资源,包括 webhook 配置、服务、命名空间、CRD 和 CR 实例 kruise-game 控制器! diff --git a/kruisegame/installation.md b/kruisegame/installation.md index be76ecc79c..361d992a67 100644 --- a/kruisegame/installation.md +++ b/kruisegame/installation.md @@ -47,6 +47,7 @@ The following table lists the configurable parameters of the kruise-game chart a | `kruiseGame.webhook.targetPort` | ObjectSelector for workloads in MutatingWebhookConfigurations | `9876` | | `kruiseGame.apiServerQps` | Maximum sustained queries per second to send to the API server of kruise-game-controller-manager | `5` | | `kruiseGame.apiServerQpsBurst` | Maximum burst queries per second to send to the API server of kruise-game-controller-manager | `10` | +| `kruiseGame.leaderElection` | Whether to enable leader-election to support HA deployment | `false` | | `replicaCount` | Replicas of kruise-game deployment | `1` | | `image.repository` | Repository for kruise-game image | `openkruise/kruise-game-manager` | | `image.tag` | Tag for kruise-game image | `v0.10.0` | @@ -87,6 +88,44 @@ If you are in China and have problem to pull image from official DockerHub, you $ helm install kruise-game https://... --set image.repository=registry-cn-hangzhou.ack.aliyuncs.com/acs/kruise-game-manager ``` +#### Optional: Use High-Availability Deployment + +If you want to use a high-availability deployment, you need to configure cert-manager to manage certificates, enable leader-election, and set `replicaCount` to be greater than or equal to 3. For example: + +```bash +$ helm install kruise-game openkruise/kruise-game \ + --set replicaCount=3 \ + --set certificates.autoGenerated=false \ + --set certificates.certManager.enabled=true \ + --set kruiseGame.leaderElection=true +``` + +To upgrade an existing deployment, you can use the following command: + +```bash +# Manage webhooks with Helm, helm <= v3.16> +$ kubectl label mutatingwebhookconfiguration kruise-game-mutating-webhook app.kubernetes.io/managed-by=Helm +$ kubectl annotate mutatingwebhookconfiguration kruise-game-mutating-webhook meta.helm.sh/release-name=kruise-game +$ kubectl annotate mutatingwebhookconfiguration kruise-game-mutating-webhook meta.helm.sh/release-namespace=default +$ kubectl label validatingwebhookconfiguration kruise-game-validating-webhook app.kubernetes.io/managed-by=Helm +$ kubectl annotate validatingwebhookconfiguration kruise-game-validating-webhook meta.helm.sh/release-name=kruise-game +$ kubectl annotate validatingwebhookconfiguration kruise-game-validating-webhook meta.helm.sh/release-namespace=default + +$ helm upgrade kruise-game openkruise/kruise-game \ + --set replicaCount=3 \ + --set certificates.autoGenerated=false \ + --set certificates.certManager.enabled=true \ + --set kruiseGame.leaderElection=true + +# helm > v3.17, you can use the --take-ownership parameter directly +$ helm upgrade kruise-game openkruise/kruise-game --take-ownership \ + --set replicaCount=3 \ + --set certificates.autoGenerated=false \ + --set certificates.certManager.enabled=true \ + --set kruiseGame.leaderElection=true +``` + + ## Uninstall OpenKruiseGame(OKG) Note that this will lead to all resources created by kruise-game, including webhook configurations, services, namespace, CRDs and CR instances kruise-game controller, to be deleted! @@ -109,5 +148,7 @@ Q: Error `CustomResourceDefinition "poddnats.alibabacloud.com" in namespace "" e A: This is because the CRD is already installed in the cluster and you can set cloudProvider.installCRD to false during installation (default is true) ## What's Next + Here are some recommended next steps: + - Learn kruise-game's [Deploy GameServers](user-manuals/deploy-gameservers.md).