1.2. 使用 Web 控制台回滚 Operator 升级
您可以使用 OpenShift Container Platform Web 控制台回滚 Operator 版本。
先决条件
-
您可以使用具有
cluster-admin权限的账户访问 OpenShift Container Platform 集群 Web 控制台。
流程
- 进入到 Operators → Installed Operators 页面。
- 找到 RHACS Operator 并点它。
- 在 Operator Details 页面中,从 Actions 列表中选择 Uninstall Operator。按照此操作,Operator 将停止运行,不再接收更新。
通过选择以下选项之一来确定您要回滚到的早期版本:
如果当前 Central 实例正在运行,您可以通过从终端窗口中运行以下命令来查询 RHACS API 来获取回滚版本:
$ curl -k -s -u <user>:<password> https://<central hostname>/v1/centralhealth/upgradestatus | jq -r .upgradeStatus.forceRollbackTo
您可以通过执行以下步骤来创建 pod 并提取之前的版本:
注意这个过程只能在安装
rocksdb数据库时用于 RHACS 版本 3.74 及更早版本。- 导航到 Workloads → Deployments → central。
- 在 Deployment details 下,单击 pod 数旁边的向下箭头,以缩减 pod。
导航到 Workloads → Pods → Create Pod,将 pod 规格的内容粘贴到编辑器中:
apiVersion: v1 kind: Pod metadata: name: get-previous-db-version spec: containers: - name: get-previous-db-version image: registry.redhat.io/advanced-cluster-security/rhacs-main-rhel8:<rollback version> command: - sh args: - '-c' - "cat /var/lib/stackrox/.previous/migration_version.yaml | grep '^image:' | cut -f 2 -d : | tr -d ' '" volumeMounts: - name: stackrox-db mountPath: /var/lib/stackrox volumes: - name: stackrox-db persistentVolumeClaim: claimName: stackrox-db- 点 Create。
- 创建 pod 后,点 Logs 选项卡来获取版本字符串。
通过执行以下步骤更新回滚配置:
- 导航到 Workloads → ConfigMaps → central-config,然后从 Actions 列表中选择 Edit ConfigMap。
-
在
central-config.yaml键的值中找到forceRollbackVersion行。 -
将
none替换为3.73.3,然后保存文件。
通过执行以下步骤将 Central 更新至早期版本:
- 导航到 Workloads → Deployments → central,然后从 Actions 列表中选择 Edit Deployment。
- 更新镜像名称,然后保存更改。
验证
确保 Central pod 启动并处于
ready状态。如果 pod 崩溃,请检查日志以查看备份是否已恢复。一个成功的日志消息类似以下示例:Clone to Migrate ".previous", ""
-
在回滚频道上重新安装 Operator。例如,
3.71.3在rhacs-3.71频道中安装。