第 6 章 将服务 Telemetry Framework 升级到 1.3
要从 Service Telemetry Framework (STF) 1.2 迁移到 STF 1.3,您必须在 Red Hat OpenShift Container Platform 环境中替换 service-telemetry
命名空间中的 ClusterServiceVersion
和 Subscription
对象。
前提条件
- 您已将 Red Hat OpenShift Container Platform 环境升级到 4.7。STF 1.3 在 Red Hat OpenShift Container Platform 4.5 上没有运行,较低.STF 1.2 不在 Red Hat OpenShift Container Platform 4.7 及更高版本上运行。
-
您已在升级环境前备份了数据。当您将 STF 1.2 升级到 1.3 时,在升级智能卡时会出现短暂的中断。另外,在替换 Operator 时,对
ServiceTelemetry
和SmartGateway
对象的更改不会有任何影响。
要从 STF 1.2 升级到 1.3,请完成以下步骤:
6.1. 删除 Service Telemetry Framework 1.2 Operator 复制链接链接已复制到粘贴板!
从 STF 1.2、智能网关 Operator 和 Service Telemetry Operator 中删除 Operator。
由于 API 接口 中的变化,您必须临时删除云
参数。这会导致删除所有智能网关,直到升级完成为止,且无法在升级过程中提供指标和事件。
流程
检索当前
ServiceTelemetry
对象并记录内容,特别是clouds
参数,因为在升级 Operator 前必须删除此参数。oc get stf default -oyaml
$ oc get stf default -oyaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 修改 ServiceTelemetry 对象,以清除
clouds
参数,并将其设置为空列表。将cloudRemoveOnMissing
设置为true
以删除所有智能网关。警告这个命令会停止所有监控功能,直到升级后,
云
对象被重新定义。如果使用默认云配置,则 ServiceTelemetry 对象中没有定义它。oc patch stf default --patch $'spec:\n clouds: []\n cloudsRemoveOnMissing: true' --type=merge
$ oc patch stf default --patch $'spec:\n clouds: []\n cloudsRemoveOnMissing: true' --type=merge
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 监控智能网关 pod,直到被完全终止和删除:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 检索 Smart Gateway Operator
的订阅
名称:oc get sub smart-gateway-operator-stable-1.2-redhat-operators-openshift-marketplace
$ oc get sub smart-gateway-operator-stable-1.2-redhat-operators-openshift-marketplace NAME PACKAGE SOURCE CHANNEL smart-gateway-operator-stable-1.2-redhat-operators-openshift-marketplace smart-gateway-operator redhat-operators stable-1.2
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 删除 Smart Gateway Operator 订阅:
oc delete sub smart-gateway-operator-stable-1.2-redhat-operators-openshift-marketplace
$ oc delete sub smart-gateway-operator-stable-1.2-redhat-operators-openshift-marketplace subscription.operators.coreos.com "smart-gateway-operator-stable-1.2-redhat-operators-openshift-marketplace" deleted
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 检索 Smart Gateway Operator ClusterServiceVersion:
oc get csv -o name | grep -E 'smart-gateway'
$ oc get csv -o name | grep -E 'smart-gateway' clusterserviceversion.operators.coreos.com/smart-gateway-operator.v2.2.1623675667
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 删除 Smart Gateway Operator ClusterServiceVersion:
oc delete clusterserviceversion.operators.coreos.com/smart-gateway-operator.v2.2.1623675667
$ oc delete clusterserviceversion.operators.coreos.com/smart-gateway-operator.v2.2.1623675667 clusterserviceversion.operators.coreos.com "smart-gateway-operator.v2.2.1623675667" deleted
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 删除 SmartGateway 自定义资源定义:
oc delete crd smartgateways.smartgateway.infra.watch
$ oc delete crd smartgateways.smartgateway.infra.watch customresourcedefinition.apiextensions.k8s.io "smartgateways.smartgateway.infra.watch" deleted
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 对 Service Telemetry Operator 订阅进行补丁以使用 stable-1.3 频道:
oc patch sub service-telemetry-operator --patch $'spec:\n channel: stable-1.3' --type=merge
$ oc patch sub service-telemetry-operator --patch $'spec:\n channel: stable-1.3' --type=merge subscription.operators.coreos.com/service-telemetry-operator patched
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 监控
oc get csv
命令的输出,直到安装了 Smart Gateway Operator,并且服务 Telemetry Operator 为Pending
for 版本 1.2 和 1.3:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 删除 Service Telemetry Operator v1.2 ClusterServiceVersion:
oc delete csv service-telemetry-operator.v1.2.1623675667
$ oc delete csv service-telemetry-operator.v1.2.1623675667 clusterserviceversion.operators.coreos.com "service-telemetry-operator.v1.2.1623675667" deleted
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 编辑 ServiceTelemetry 对象并插入您之前记录的
cloud
参数的内容。如果之前没有定义cloud
参数,因为您使用默认的 Smart Gateway 实例,删除cloud: []
参数。oc edit stf default
$ oc edit stf default
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 验证智能卡是否已恢复:
oc get pods --selector app=smart-gateway
$ oc get pods --selector app=smart-gateway NAME READY STATUS RESTARTS AGE default-cloud1-ceil-meter-smartgateway-6484b98b68-sl7mb 2/2 Running 0 5m56s default-cloud1-coll-meter-smartgateway-799f687658-nfzr6 2/2 Running 0 6m6s
Copy to Clipboard Copied! Toggle word wrap Toggle overflow