Soorya Prakash
Soorya Prakash

Reputation: 991

MongoDB Kubernetes Operator - Warning- Containers with unready status: [mongodb-agent]

I am using the MongoDB Kubernetes Operator version 0.6.0 and MongoDB version as 5.0.24. I am deploying it in the GKE cluster version 1.27.8-gke.1067004.

The deployment was successful but when I check the pods, one of the pod shows warning as containers with unready status: [mongodb-agent]

When I check the events for the pod that shows warning it has below logs Message: Readiness probe failed: Reason: Unhealthy

apiVersion: mongodbcommunity.mongodb.com/v1
kind: MongoDBCommunity
metadata:
    name: my-mongo
spec:
    members: 2
    type: ReplicaSet
    version: '5.0.4'
    security:
        authentication:
            modes: ['SCRAM']
    users:
        - name: admin
          db: admin
          passwordSecretRef:
              name: mongo-admin-password
          roles:
              - name: clusterAdmin
                db: admin
              - name: userAdminAnyDatabase
                db: admin
              - name: dbAdminAnyDatabase
                db: admin
              - name: readWriteAnyDatabase
                db: admin
          scramCredentialsSecretName: admin
        - name: myapp
          db: mydb
          passwordSecretRef:
              name: mongo-app-password
          roles:
              - name: readWrite
                db: mydb
          scramCredentialsSecretName: myapp
    additionalMongodConfig:
        storage.wiredTiger.engineConfig.journalCompressor: zlib
    statefulSet:
        spec:
            template:
                spec:
                    # resources can be specified by applying an override per container name.
                    containers:
                        - name: mongod
                          resources:
                              limits:
                                  cpu: '0.2'
                                  memory: 250M
                              requests:
                                  cpu: '0.2'
                                  memory: 200M
                        - name: mongodb-agent
                          resources:
                              limits:
                                  cpu: '0.2'
                                  memory: 250M
                              requests:
                                  cpu: '0.2'
                                  memory: 200M

# The user credentials will be generated from this secret
# Once the credentials are generated, this secret is no longer required
---
apiVersion: v1
kind: Secret
metadata:
    name: mongo-admin-password
type: Opaque
stringData:
    password: YYYY
---
apiVersion: v1
kind: Secret
metadata:
    name: mongo-app-password
type: Opaque
stringData:
    password: XXXXX

Could you please suggest, how can I resolve this issue?

Upvotes: 0

Views: 1120

Answers (1)

Can
Can

Reputation: 88

It looks like you're having a readiness probe issue with the mongodb-agent container in your MongoDB Kubernetes deployment. Take a look at your StatefulSet definition and make sure the readiness probe for the mongodb-agent container is set up correctly. Ensure the path and port are accurate, and that the /healthz endpoint is accessible.

containers:
  - name: mongodb-agent
    readinessProbe:
      httpGet:
        path: /healthz
        port: 5556

Dive into the logs for the mongodb-agent container to get more details on why the readiness probe is failing.

kubectl logs <pod-name> -c mongodb-agent

Upvotes: 0

Related Questions