当前位置:网站首页>灰度升级 TiDB Operator
灰度升级 TiDB Operator
2022-07-06 07:58:00 【添香小铺】
如果你希望升级 TiDB Operator 至新版本,同时希望控制升级的影响范围,避免对整个 Kubernetes 集群中的所有 TiDB 集群产生不可预知的影响,可以采用灰度升级的方式升级 TiDB Operator。使用灰度升级后,你可以在灰度部署的集群中确认 TiDB Operator 升级的影响,在确认 TiDB Operator 新版本稳定工作后,再正常升级 TiDB Operator。
TiDB Operator 目前只支持对部分组件进行灰度升级,即 tidb-controller-manager 和 tidb-scheduler,不支持对增强型 StatefulSet 控制器和准入控制器进行灰度升级。
在使用 TiDB Operator 时,tidb-scheduler
并不是必须使用。你可以参考 tidb-scheduler 与 default-scheduler,确认是否需要部署 tidb-scheduler
。
第 1 步:为当前 TiDB Operator 配置 selector 并执行升级
在当前 TiDB Operator 的 values.yaml
中,添加如下 selector 配置:
controllerManager: selector: - version!=canary
参考在线升级或离线升级,对当前 TiDB Operator 执行升级步骤:
helm upgrade tidb-operator pingcap/tidb-operator --version=${chart_version} -f ${HOME}/tidb-operator/values-tidb-operator.yaml
第 2 步:部署灰度的 TiDB Operator
参考在线部署 TiDB Operator 的第 1 步和第 2 步,获取想要部署的灰度版本 TiDB Operator 的
values.yaml
文件,并在values.yaml
中添加如下配置。controllerManager: selector: - version=canary appendReleaseSuffix: true #scheduler: # create: false # 如果你不需要 `tidb-scheduler`,将这个值设置为 false advancedStatefulset: create: false admissionWebhook: create: false
appendReleaseSuffix
需要设置为true
。如果不需要灰度升级 tidb-scheduler,可以设置
scheduler.create: false
。如果需要灰度升级 tidb-scheduler,配置scheduler.create: true
,会创建一个名字为{ { .scheduler.schedulerName }}-{ {.Release.Name}}
的 scheduler。如果要在灰度部署的 TiDB Operator 中使用这个 scheduler,需要配置 TidbCluster CR 中的spec.schedulerName
为这个 scheduler 的名字。由于灰度升级不支持增强型 StatefulSet 控制器和准入控制器,必须配置
advancedStatefulset.create: false
和admissionWebhook.create: false
。如需了解灰度部署相关参数的详细信息,可参考使用多套 TiDB Operator 单独管理不同的 TiDB 集群 - 相关参数。
在不同的 namespace 中(例如
tidb-admin-canary
),使用不同的 Helm Release Name(例如helm install tidb-operator-canary ...
)部署灰度的 TiDB Operator:helm install tidb-operator-canary pingcap/tidb-operator --namespace=tidb-admin-canary --version=${operator_version} -f ${HOME}/tidb-operator/${operator_version}/values-tidb-operator.yaml
将
${operator_version}
替换为你需要灰度升级到的 TiDB Operator 版本号。
第 3 步:测试灰度的 TiDB Operator (可选)
在正常升级 TiDB Operator 前,可以测试灰度部署的 TiDB Operator 是否稳定工作。支持测试的组件有 tidb-controller-manager 和 tidb-scheduler。
如果需要测试灰度部署的 tidb-controller-manager,可通过如下命令,为某个 TiDB 集群设置 label:
kubectl -n ${namespace} label tc ${cluster_name} version=canary
通过查看已经部署的两个 tidb-controller-manager 的日志,可以确认这个设置 label 的 TiDB 集群已经由灰度部署的 TiDB Operator 管理。查看日志的步骤如下:
查看当前 TiDB Operator 的 tidb-controller-manager 的日志:
kubectl -n tidb-admin logs tidb-controller-manager-55b887bdc9-lzdwv
预期的输出如下:
I0305 07:52:04.558973 1 tidb_cluster_controller.go:148] TidbCluster has been deleted tidb-cluster-1/basic1
查看灰度部署的 TiDB Operator 的 tidb-controller-manager 的日志:
kubectl -n tidb-admin-canary logs tidb-controller-manager-canary-6dcb9bdd95-qf4qr
预期的输出如下:
I0113 03:38:43.859387 1 tidbcluster_control.go:69] TidbCluster: [tidb-cluster-1/basic1] updated successfully
如果需要测试灰度部署的 tidb-scheduler,可通过如下命令,为某个 TiDB 集群修改
spec.schedulerName
为tidb-scheduler-canary
:kubectl -n ${namespace} edit tc ${cluster_name}
修改后,集群内各组件会滚动升级,通过查看灰度部署的 TiDB Operator 的
tidb-scheduler
的日志,可以确认集群已经使用灰度tidb-scheduler
:kubectl -n tidb-admin-canary logs tidb-scheduler-canary-7f7b6c7c6-j5p2j -c tidb-scheduler
测试完成后,可撤销前两步中的修改,重新使用当前的 TiDB Operator 来管理 TiDB 集群。
kubectl -n ${namespace} label tc ${cluster_name} version-
kubectl -n ${namespace} edit tc ${cluster_name}
第 4 步:正常升级 TiDB Operator
确认灰度部署的 TiDB Operator 已经正常工作后,可以正常升级 TiDB Operator。
删除灰度部署的 TiDB Operator:
helm -n tidb-admin-canary uninstall ${release_name}
边栏推荐
- 华为云OBS文件上传下载工具类
- edge浏览器 路径获得
- Secure captcha (unsafe verification code) of DVWA range
- 数据治理:元数据管理篇
- 你想知道的ArrayList知识都在这
- [t31zl intelligent video application processor data]
- 继电反馈PID控制器参数自整定
- [1. Delphi foundation] 1 Introduction to Delphi Programming
- What are the ways to download network pictures with PHP
- 实现精细化生产, MES、APS、ERP必不可少
猜你喜欢
你想知道的ArrayList知识都在这
Risk planning and identification of Oracle project management system
Uibehavior, a comprehensive exploration of ugui source code
Secure captcha (unsafe verification code) of DVWA range
2.10transfrom attribute
File upload of DVWA range
"Designer universe": "benefit dimension" APEC public welfare + 2022 the latest slogan and the new platform will be launched soon | Asia Pacific Financial Media
[count] [combined number] value series
In the era of digital economy, how to ensure security?
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
随机推荐
[cf gym101196-i] waif until dark network maximum flow
Pangolin Library: control panel, control components, shortcut key settings
[count] [combined number] value series
edge瀏覽器 路徑獲得
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
PHP - Common magic method (nanny level teaching)
链表面试题(图文详解)
Data governance: metadata management
Hackathon ifm
Hill sort c language
JS select all and tab bar switching, simple comments
[untitled]
Wireshark grabs packets to understand its word TCP segment
P3047 [USACO12FEB]Nearby Cows G(树形dp)
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
National economic information center "APEC industry +": economic data released at the night of the Spring Festival | observation of stable strategy industry fund
上线APS系统,破除物料采购计划与生产实际脱钩的难题
Get the path of edge browser
"Friendship and righteousness" of the center for national economy and information technology: China's friendship wine - the "unparalleled loyalty and righteousness" of the solidarity group released th
[nonlinear control theory]9_ A series of lectures on nonlinear control theory