Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] mongodb cluster start failed #8437

Closed
shuoshadow opened this issue Nov 11, 2024 · 13 comments
Closed

[BUG] mongodb cluster start failed #8437

shuoshadow opened this issue Nov 11, 2024 · 13 comments
Assignees
Labels
kind/bug Something isn't working
Milestone

Comments

@shuoshadow
Copy link

shuoshadow commented Nov 11, 2024

Kubernetes: v1.28.9
KubeBlocks: 0.9.2-beta.8
kbcli: 0.9.1
WARNING: version difference between kbcli (0.9.1) and kubeblocks (0.9.2-beta.8) 
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
  name: test-mongodb
  namespace: kb-cloud
spec:
  clusterDefinitionRef: mongodb
  clusterVersionRef: mongodb-5.0
  terminationPolicy: Delete
  affinity:
    podAntiAffinity: Preferred
    topologyKeys:
    - kubernetes.io/hostname
  tolerations:
    - key: "node-type"
      operator: "Equal"
      value: "mid"
      effect: "NoSchedule"
  componentSpecs:
  - name: mongodb
    componentDefRef: mongodb
    enabledLogs:
    - running
    disableExporter: false
    serviceAccountName: kb-mongo-cluster
    replicas: 3
    resources:
      limits:
        cpu: '4'
        memory: 4Gi
      requests:
        cpu: '1'
        memory: 2Gi
    volumeClaimTemplates:
    - name: data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 200Gi
        storageClassName: openebs-hostpath
Name: test-mongodb       Created Time: Nov 11,2024 07:32 UTC+0000
NAMESPACE   CLUSTER-DEFINITION   VERSION       STATUS     TERMINATION-POLICY   
kb-cloud    mongodb              mongodb-5.0   Creating   Delete               

Endpoints:
COMPONENT   MODE        INTERNAL                                                EXTERNAL   
mongodb     ReadWrite   test-mongodb-mongodb.kb-cloud.svc.cluster.local:27017   <none>     

Topology:
COMPONENT   INSTANCE                 ROLE     STATUS    AZ       NODE                          CREATED-TIME                 
mongodb     test-mongodb-mongodb-0   <none>   Running   <none>   dev-k8s-mid03/10.10.111.246   Nov 11,2024 07:32 UTC+0000   
mongodb     test-mongodb-mongodb-1   <none>   Running   <none>   dev-k8s-mid07/10.10.111.242   Nov 11,2024 07:32 UTC+0000   
mongodb     test-mongodb-mongodb-2   <none>   Running   <none>   dev-k8s-mid08/10.10.111.241   Nov 11,2024 07:32 UTC+0000   

Resources Allocation:
COMPONENT   DEDICATED   CPU(REQUEST/LIMIT)   MEMORY(REQUEST/LIMIT)   STORAGE-SIZE   STORAGE-CLASS      
mongodb     false       1 / 4                2Gi / 4Gi               data:200Gi     openebs-hostpath   

Images:
COMPONENT   TYPE      IMAGE                                                                    
mongodb     mongodb   apecloud-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/mongo:5.0.14   

Data Protection:
BACKUP-REPO   AUTO-BACKUP   BACKUP-SCHEDULE   BACKUP-METHOD   BACKUP-RETENTION   RECOVERABLE-TIME   

Show cluster events: kbcli cluster list-events -n kb-cloud test-mongodb

image
image

image

@shuoshadow shuoshadow added the kind/bug Something isn't working label Nov 11, 2024
@xuriwuyun
Copy link
Contributor

Is this a new cluster or a backup-restore cluster? Please provide the console output of the MongoDB container in pod test-mongodb-mongodb-0.

@h-shihao
Copy link

你好,我想请教一下,你是如何实现修改镜像地址docker.io/apecloud/mongo:5.0.14为apecloud-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/mongo:5.0.14 的?

@xuriwuyun
Copy link
Contributor

this can be made by upgrade mongodb-addon with
`
helm repo add kubeblocks-addons https://jihulab.com/api/v4/projects/150246/packages/helm/stable

helm upgrade -i kb-addon-mongodb kubeblocks-addons/mongodb -n kb-system --set image.repository=apecloud/mongo,image.registry=apecloud-registry.cn-zhangjiakou.cr.aliyuncs.com
`

@shuoshadow
Copy link
Author

Is this a new cluster or a backup-restore cluster? Please provide the console output of the MongoDB container in pod test-mongodb-mongodb-0.

HI, That's a new cluster, there is no log in pod test-mongodb-mongodb-0.

image

@xuriwuyun
Copy link
Contributor

xuriwuyun commented Nov 11, 2024

The MongoDB add-on may be outdated. You can upgrade it by using the following command:
helm upgrade -i kb-addon-mongodb kubeblocks-addons/mongodb -n kb-system
, and then try again.

@shanshanying
Copy link
Contributor

@shuoshadow

Or you can use kbcli addon search mongodb to fetch the list of available versionss.
And upgrade you MongoDB Addon use kbcli addon upgrade mongodb --version <version-for-kb09> (versions with prefix 0.9)

@shuoshadow
Copy link
Author

shuoshadow commented Nov 12, 2024

@shanshanying

@shuoshadow

Or you can use kbcli addon search mongodb to fetch the list of available versionss. And upgrade you MongoDB Addon use kbcli addon upgrade mongodb --version <version-for-kb09> (versions with prefix 0.9)

I executed the command, but it had no effect and still failed to start.
image

@xuriwuyun
Copy link
Contributor

Please provide the YAML for the cluster and pod, as well as the console output from the MongoDB container in the pod.

@shuoshadow
Copy link
Author

shuoshadow commented Nov 12, 2024

Please provide the YAML for the cluster and pod, as well as the console output from the MongoDB container in the pod.

apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
  name: test-mongodb
  namespace: kb-cloud
spec:
  clusterDefinitionRef: mongodb
  clusterVersionRef: mongodb-5.0
  terminationPolicy: Delete
  affinity:
    podAntiAffinity: Preferred
    topologyKeys:
    - kubernetes.io/hostname
  tolerations:
    - key: "node-type"
      operator: "Equal"
      value: "mid"
      effect: "NoSchedule"
  componentSpecs:
  - name: mongodb
    componentDefRef: mongodb
    enabledLogs:
    - running
    disableExporter: false
    serviceAccountName: kb-mongo-cluster
    replicas: 3
    resources:
      limits:
        cpu: '4'
        memory: 4Gi
      requests:
        cpu: '1'
        memory: 2Gi
    volumeClaimTemplates:
    - name: data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 200Gi
        storageClassName: openebs-hostpath

@shuoshadow
Copy link
Author

shuoshadow commented Nov 12, 2024

Is this a new cluster or a backup-restore cluster? Please provide the console output of the MongoDB container in pod test-mongodb-mongodb-0.

HI, That's a new cluster, there is no log in pod test-mongodb-mongodb-0.

image

@xuriwuyun no any log output

the file log /data/mongodb/logs/mongodb.log in pod test-mongodb-mongodb-0.

image

@shanshanying shanshanying added this to the Release 0.9.2 milestone Nov 13, 2024
@xuriwuyun
Copy link
Contributor

i see, the cluster yaml is outdated, you can use this new template instead:

`
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
name: mongo-cluster
namespace: default
spec:
componentSpecs:

  • componentDef: mongodb
    name: mongodb
    replicas: 3
    resources:
    limits:
    cpu: "0.5"
    memory: 0.5Gi
    requests:
    cpu: "0.5"
    memory: 0.5Gi
    serviceVersion: 6.0.16
    volumeClaimTemplates:
    • name: data
      spec:
      accessModes:
      • ReadWriteOnce
        resources:
        requests:
        storage: 20Gi
        terminationPolicy: Delete
        `

@shuoshadow
Copy link
Author

shuoshadow commented Nov 13, 2024

i see, the cluster yaml is outdated, you can use this new template instead:

` apiVersion: apps.kubeblocks.io/v1alpha1 kind: Cluster metadata: name: mongo-cluster namespace: default spec: componentSpecs:

  • componentDef: mongodb
    name: mongodb
    replicas: 3
    resources:
    limits:
    cpu: "0.5"
    memory: 0.5Gi
    requests:
    cpu: "0.5"
    memory: 0.5Gi
    serviceVersion: 6.0.16
    volumeClaimTemplates:

    • name: data
      spec:
      accessModes:

      • ReadWriteOnce
        resources:
        requests:
        storage: 20Gi
        terminationPolicy: Delete
        `

image

image

Message:               cluster API validate error, clusterDef: , topology: , comps: 1, legacy comps: 1, simplified API: false

no pod were created

@shuoshadow
Copy link
Author

@xuriwuyun

  Warning  Warning         8m30s (x12 over 8m40s)  cluster-controller  no matched component definition found: mongodb
  Warning  PreCheckFailed  3m12s (x17 over 8m40s)  cluster-controller  no matched component definition found: mongodb

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants