簡體   English   中英

mongodb 算子部署在 openshift “Failed to apply default image tag ”/:4.2.6“ invalid reference format”

[英]mongodb operator deployment in openshift “Failed to apply default image tag ”/:4.2.6“ invalid reference format”

我指的是來自https://github.com/mongodb/mongodb-kubernetes-operator的 mongodb 社區運營商,並嘗試將其部署在 openshift 或 okd

git clone https://github.com/mongodb/mongodb-kubernetes-operator.git
cd mongodb-kubernetes-operator 
kubectl create namespace mongodb
kubectl create -f deploy/operator/role.yaml --namespace mongodb
kubectl create -f deploy/operator/role_binding.yaml --namespace mongodb
kubectl create -f deploy/operator/service_account.yaml --namespace mongodb
kubectl create -f deploy/crds/mongodb.com_mongodb_crd.yaml --namespace mongodb

oc apply -f deploy/openshift/operator_openshift.yaml -n mongodb
oc apply -f deploy/crds/mongodb.com_v1_mongodb_openshift_cr.yaml -n mongodb

Operator pod 已成功運行,但 mongodb 副本集 pod 未出現。 錯誤如下

[kubenode@master mongodb-kubernetes-operator]$ oc get pods
NAME                                           READY     STATUS             RESTARTS   AGE
example-openshift-mongodb-0                    0/2       InvalidImageName   10         31m
mongodb-kubernetes-operator-66bfcbcf44-rqp5l   1/1       Running            0          32m


 Failed to apply default image tag "/:4.2.6": couldn't parse image reference "/:4.2.6": invalid reference format

在此處輸入圖像描述 此處錯誤表明它正在提取錯誤的圖像,我嘗試使用oc edit statefulset.apps/example-openshift-mongodb更新圖像。 正確更新圖像名稱並保存后,我看不到保存的更改。 請讓我知道如何將圖像更新為正確的圖像

運營商信息

  • 運營商版本:0.3.0
  • MongoDB 使用的圖像:4.2.6

Kubernetes 集群信息

[kubenode@master mongodb-kubernetes-operator]$ openshift version
openshift v3.11.0+62803d0-1

[kubenode@master mongodb-kubernetes-operator]$ kubectl version
Client Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.0+d4cacc0", GitCommit:"d4cacc0", GitTreeState:"clean", BuildDate:"2018-10-15T09:45:30Z", GoVersion:"go1.10.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.0+d4cacc0", GitCommit:"d4cacc0", GitTreeState:"clean", BuildDate:"2020-12-07T17:59:40Z", GoVersion:"go1.10.8", Compiler:"gc", Platform:"linux/amd64"}

您可以使用此命令更新 mongo 的部署映像

kubectl set image deployment/deployment-name contianerame=image:tag

在您的情況下,您可以清楚地看到您嘗試更新的 MongoDB 圖像的標簽存在問題

Failed to apply default image tag "/:4.2.6": couldn't parse image reference "/:4.2.6": invalid reference format

您還可以通過編輯部署或狀態集來更新映像

kubectl 編輯deployment or statefulsets集部署或狀態集name of deployment or statefulsets

我意識到,由於 mongo statefulset 是使用 operator 和 crd https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/創建的,因此直接對 statefulsets 所做的更改不會被保存。 因此編輯 CRD 文件https://github.com/mongodb/mongodb-kubernetes-operator/blob/master/deploy/crds/mongodb.com_v1_mongodb_openshift_cr.yaml幫助我解決了這個問題。 在 mongodb.com_v1_mongodb_openshift_cr.yaml 中的第 33 行之后添加一個帶有image: mongo:4.2.6的新行,然后部署

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM