你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
本文介绍如何使用 Azure CLI (az) 升级直接连接的已启用 Azure Arc 的数据控制器。
在数据控制器升级期间,可能会升级数据控制平面的某些部分,例如自定义资源定义 (CRD) 和容器。 升级数据控制器不会造成数据服务的停机。
Prerequisites
需要具有 imageTag v1.0.0_2021-07-30 或更高版本的直接连接的数据控制器。
若要检查版本,请运行:
kubectl get datacontrollers -n <namespace> -o custom-columns=BUILD:.spec.docker.imageTag
Install tools
在继续完成本文中的任务之前,需要安装以下项:
本文中的示例使用尖括号 < ... > 来标识在运行脚本之前需要替换的值。 替换括号和括号中的值。
arcdata 扩展版本与映像版本相关。 Check that you have the correct arcdata extension version that corresponds to the image version you want to upgrade to in the Version log.
查看可用映像并选择版本
使用以下命令拉取数据控制器的可用映像列表:
az arcdata dc list-upgrades --k8s-namespace <namespace>
上述命令返回如以下示例所示的输出:
Found 2 valid versions. The current datacontroller version is v1.0.0_2021-07-30.
v1.1.0_2021-11-02
v1.0.0_2021-07-30
升级数据控制器
本部分演示如何升级直接连接的数据控制器。
Note
一些数据服务层级和模式已经是正式发布版,有些则以预览版提供。 如果在同一数据控制器上安装正式发布版和预览版服务,则无法就地升级。 若要升级,请删除所有非正式发布版数据库实例。 You can find the list of generally available and preview services in the Release Notes.
有关支持的升级路径,请参阅升级已启用 Azure Arc 的数据服务。
Authenticate
在开始升级 Azure Arc 数据控制器之前,你将需要连接到 Kubernetes 群集并向其进行身份验证,并选择一个现有的 Kubernetes 上下文。
kubectl config use-context <Kubernetes cluster name>
升级数据控制器
可以先执行试运行。 试运行验证注册表是否存在、版本架构和专用存储库授权令牌(如果使用)。 若要执行试运行,请使用 --dry-run 命令中的 az arcdata dc upgrade 参数。 For example:
az arcdata dc upgrade --resource-group <resource group> --name <data controller name> --desired-version <version> --dry-run [--no-wait]
以上命令的输出为:
Preparing to upgrade dc arcdc in namespace arc to version <version-tag>.
****Dry Run****
Arcdata Control Plane would be upgraded to: <version-tag>
升级 Arc 数据控制器扩展后,运行 az arcdata dc upgrade 命令,并指定 --desired-version 映像标记。
az arcdata dc upgrade --resource-group <resource group> --name <data controller name> --desired-version <version> [--no-wait]
Example:
az arcdata dc upgrade --resource-group rg-arcds --name dc01 --desired-version v1.7.0_2022-05-24 [--no-wait]
监视升级状态
可以使用 CLI 监视升级进度。
CLI
az arcdata dc status show --resource-group <resource group>
升级过程分为两部分。 首先升级控制器,然后升级监视堆栈。 升级完成后,输出将为:
Ready
Troubleshooting
当所需版本设置为特定版本时,引导程序作业将尝试升级到该版本,直到它成功为止。 如果升级成功,则规范的 RunningVersion 属性将更新为新版本。 对于映像标记不正确、无法连接到注册表或存储库、分配给容器的 CPU 或内存不足或存储不足等情况,升级可能会失败。
运行以下命令,查看是否有任何 Pod 显示
Error状态或具有较高重启次数:kubectl get pods --namespace <namespace>要查看事件以了解是否存在错误,请运行
kubectl describe pod <pod name> --namespace <namespace>若要获取 Pod 中的容器列表,请运行
kubectl get pods <pod name> --namespace <namespace> -o jsonpath='{.spec.containers[*].name}*'要获取容器的日志,请运行
kubectl logs <pod name> <container name> --namespace <namespace>
To view common errors and how to troubleshoot them go to Troubleshooting resources.