当前位置:网站首页>灰度升级 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}
边栏推荐
- Uibehavior, a comprehensive exploration of ugui source code
- MFC sends left click, double click, and right click messages to list controls
- 图像融合--挑战、机遇与对策
- 二叉树创建 & 遍历
- WebRTC系列-H.264预估码率计算
- [Yugong series] creation of 009 unity object of U3D full stack class in February 2022
- Esrally domestic installation and use pit avoidance Guide - the latest in the whole network
- Solution: intelligent site intelligent inspection scheme video monitoring system
- Golang DNS 随便写写
- MFC 给列表控件发送左键单击、双击、以及右键单击消息
猜你喜欢
数据治理:主数据的3特征、4超越和3二八原则
Asia Pacific Financial Media | art cube of "designer universe": Guangzhou community designers achieve "great improvement" in urban quality | observation of stable strategy industry fund
珠海金山面试复盘
Secure captcha (unsafe verification code) of DVWA range
National economic information center "APEC industry +": economic data released at the night of the Spring Festival | observation of stable strategy industry fund
【Redis】NoSQL数据库和redis简介
Document 2 Feb 12 16:54
Nft智能合约发行,盲盒,公开发售技术实战--合约篇
Asia Pacific Financial Media | designer universe | Guangdong responds to the opinions of the national development and Reform Commission. Primary school students incarnate as small community designers
[nonlinear control theory]9_ A series of lectures on nonlinear control theory
随机推荐
Data governance: metadata management
Hill sort c language
[Yugong series] February 2022 U3D full stack class 010 prefabricated parts
软件开发的一点随记
使用 TiDB Lightning 恢复 S3 兼容存储上的备份数据
Common functions for PHP to process strings
Data governance: 3 characteristics, 4 transcendence and 3 28 principles of master data
Get the path of edge browser
[1. Delphi foundation] 1 Introduction to Delphi Programming
上线APS系统,破除物料采购计划与生产实际脱钩的难题
How to estimate the number of threads
In the era of digital economy, how to ensure security?
"Designer universe": "benefit dimension" APEC public welfare + 2022 the latest slogan and the new platform will be launched soon | Asia Pacific Financial Media
Risk planning and identification of Oracle project management system
(lightoj - 1410) consistent verbs (thinking)
指针和数组笔试题解析
Solution: système de surveillance vidéo intelligent de patrouille sur le chantier
Mex related learning
Go learning notes (3) basic types and statements (2)
数据治理:微服务架构下的数据治理