环境
Red Hat OpenShift Container Platform (RHOCP)
4.10
4.11
4.12
4.13
4.14
Issue
OpenShift Container Platform 4.14 至 4.10 中,位于 openshift-marketplace 命名空间中的 Pod 经常被创建和终止。
pod 的 openshift-marketplace 命名空间中的多个事件被创建和终止。
31m Normal AddedInterface pod/redhat-operators-name Add eth0 [172.0.0.0/23] from ovn-kubernetes
31m Normal Pulling pod/redhat-operators-name Pulling image "registry.redhat.io/redhat/redhat-operator-index:v4.12"
31m Normal Pulled pod/redhat-operators-name Successfully pulled image "registry.redhat.io/redhat/redhat-operator-index:v4.12" in 1.562343266s (1.562350584s including waiting)
31m Normal Created pod/redhat-operators-name Created container registry-server
31m Normal Started pod/redhat-operators-name Started container registry-server
31m Normal Killing pod/redhat-operators-name Stopping container registry-server
解决
警告:未经 Red Hat OpenShift 技术支持指导,请勿执行这些步骤。
注意:禁用默认 CatalogSource 意味着它不再由 Marketplace Operator 管理,而是由集群管理员负责管理。此外,如果您已经通过默认目录安装了操作员,那么将会出现如下事件,还安装了operator 抱怨Catlogsource被删除。
constraints not satisfiable: no operators found from catalog certified-operators in namespace openshift-marketplace referenced by subscription name-operator, subscription name-operator exists
- 备份命名空间 openshift-marketplace 中的默认 Catlogsource
for i in `oc get catalogsources --no-headers -n openshift-marketplace | awk '{print $1}'` ; do oc get catalogsources -n openshift-marketplace $i -o yaml > $i.yaml; done
- 验证文件和内容:
certified-operators.yaml
community-operators.yaml
redhat-marketplace.yaml
redhat-operators.yaml
- 禁用默认的 catalogsource
oc patch OperatorHub cluster --type json -p '[{"op": "add", "path": "/spec/disableAllDefaultSources", "value": true}]'
oc patch operatorhub/cluster --type=merge -p '{"spec":{"sources":[{"disabled":true,"name":"redhat-operators"}]}}'
Verify no default catalogsource should exist.
- 验证不应存在默认catalogsource。
oc get catalogsource -n openshift-marketplace
- 编辑我们在第一步中备份的文件并更改相应catalogsource的名称,例如:
vi redhat-operators.yaml
name: redhat-operators << change this name as like redhat-operators-1 . Ultimate goal is to modify each catalogsource name from default to new name.
- 同时删除 Generation/uid 行
- 现在对所有文件执行相同的操作。
- 更改默认名称后,让我们使用 oc create -f 创建自定义catalog
oc create -f certified-operators.yaml
oc create -f community-operators.yaml
oc create -f redhat-marketplace.yaml
oc create -f redhat-operators.yaml
- 使用以下命令验证必须创建新的 Catalogsource 和相应的 Pod。
# oc get catsrc -n openshift-marketplace;oc get pods -n openshift-marketplace
NAME DISPLAY TYPE PUBLISHER AGE
certified-operators-1 Certified Operators grpc Red Hat 86s
community-operators-1 Community Operators grpc Red Hat 5m5s
redhat-marketplace-1 Red Hat Marketplace grpc Red Hat 5m5s
redhat-operators-1 Red Hat Operators grpc Red Hat 5m5s
NAME READY STATUS RESTARTS AGE
certified-operators-1-wfz9g 1/1 Running 0 86s
community-operators-1-8f2js 1/1 Running 0 5m5s
marketplace-operator-6f9748c96f-b75dz 1/1 Running 1 3d20h
redhat-marketplace-1-mjzzr 1/1 Running 0 5m4s
redhat-operators-1-9cbnr 1/1 Running 0 5m4s
- 现在继续更改 updateStrategy.registryPoll.interval 的值:每个 catalosource 为 10m0s(例如 87h)。
# oc edit CatalogSource <CatalogSource_name>
spec:
updateStrategy:
registryPoll:
interval: 87h
根本原因:
此问题是由 OpenShift Container Platform 4.13-4.10 中的一个已知错误引起的,更多信息可在此处找到:KCS 7016065。