6.7. 更新托管的集群中的 control plane
在托管的 control plane 上,您可以通过更新托管集群来升级 OpenShift Container Platform 的版本。HostedCluster 自定义资源 (CR) 中的 .spec.release 显示 control plane 的版本。HostedCluster 将 .spec.release 字段更新为 HostedControlPlane.spec.release,并运行适当的 Control Plane Operator 版本。
HostedControlPlane 资源通过 Cluster Version Operator (CVO) 的新版本编配 control plane 组件的推出以及数据平面中的 OpenShift Container Platform 组件。HostedControlPlane 包括以下工件:
- CVO
- Cluster Network Operator (CNO)
- Cluster Ingress Operator
- Kube API 服务器、调度程序和管理器的清单
- 机器批准
- Autoscaler(自动缩放器)
- 基础架构资源为 control plane 端点启用入口,如 Kube API 服务器、ignition 和 konnectivity
您可以使用 status.version.availableUpdates 和 status.version.conditionalUpdates 字段中的信息,将 HostedCluster CR 中的 .spec.release 字段设置为更新 control plane。
流程
输入以下命令将
hypershift.openshift.io/force-upgrade-to=<openshift_release_image>注解添加到托管集群:oc annotate hostedcluster -n <hosted_cluster_namespace> <hosted_cluster_name> "hypershift.openshift.io/force-upgrade-to=<openshift_release_image>" --overwrite
$ oc annotate hostedcluster -n <hosted_cluster_namespace> <hosted_cluster_name> "hypershift.openshift.io/force-upgrade-to=<openshift_release_image>" --overwrite1 2 Copy to Clipboard Copied! Toggle word wrap Toggle overflow 输入以下命令更改托管的集群中的
spec.release.image值:oc patch hostedcluster <hosted_cluster_name> -n <hosted_cluster_namespace> --type=merge -p '{"spec":{"release":{"image":"<openshift_release_image>"}}}'$ oc patch hostedcluster <hosted_cluster_name> -n <hosted_cluster_namespace> --type=merge -p '{"spec":{"release":{"image":"<openshift_release_image>"}}}'Copy to Clipboard Copied! Toggle word wrap Toggle overflow
验证
要验证新版本是否已推出,请运行以下命令检查托管的集群中的
.status.conditions和.status.version值:oc get -n <hosted_cluster_namespace> hostedcluster <hosted_cluster_name> -o yaml
$ oc get -n <hosted_cluster_namespace> hostedcluster <hosted_cluster_name> -o yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow 输出示例
Copy to Clipboard Copied! Toggle word wrap Toggle overflow