Issue with the deployment of the mongodb-persistent pod from the openshift templates using the local volume storage.

Solution Verified - Updated -

Issue

  • After deploying the openshift mongodb template the pod fails to get scheduled on the node and the pvc waits for first consumer to be created before binding.
# oc project openshift

# oc new-app --template=mongodb-persistent -n project-name

# oc get pods -n project-name

# oc describe po mongodb-1-2lw55

Name:           mongodb-1-2lw55
Namespace:      openshift
Priority:       0
Node:           <none>
Labels:         deployment=mongodb-1
                deploymentconfig=mongodb
                name=mongodb
Annotations:    openshift.io/deployment-config.latest-version: 1
                openshift.io/deployment-config.name: mongodb
                openshift.io/deployment.name: mongodb-1
                openshift.io/generated-by: OpenShiftNewApp
Status:         Pending
IP:             
IPs:            <none>
Controlled By:  ReplicationController/mongodb-1
Containers:
  mongodb:
    Image:      registry.redhat.io/rhscl/mongodb-36-rhel7@sha256:506e4daa19721199e35249f2e0e67b02cbcbee1fed653f7eb91d5595b74c3bf8
    Port:       27017/TCP
    Host Port:  0/TCP
    Limits:
      memory:  512Mi
    Requests:
      memory:   512Mi
    Liveness:   tcp-socket :27017 delay=30s timeout=1s period=10s #success=1 #failure=3
    Readiness:  exec [/bin/sh -i -c mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD --eval="quit()"] delay=3s timeout=1s period=10s #success=1 #failure=3
    Environment:
      MONGODB_USER:            <set to the key 'database-user' in secret 'mongodb'>            Optional: false
      MONGODB_PASSWORD:        <set to the key 'database-password' in secret 'mongodb'>        Optional: false
      MONGODB_ADMIN_PASSWORD:  <set to the key 'database-admin-password' in secret 'mongodb'>  Optional: false
      MONGODB_DATABASE:        <set to the key 'database-name' in secret 'mongodb'>            Optional: false
    Mounts:
      /var/lib/mongodb/data from mongodb-data (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-2h57c (ro)
Conditions:
  Type           Status
  PodScheduled   False 
Volumes:
  mongodb-data:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  mongodb
    ReadOnly:   false
  default-token-2h57c:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-2h57c
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/memory-pressure:NoSchedule
                 node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age        From               Message
  ----     ------            ----       ----               -------
  Warning  FailedScheduling  <unknown>  default-scheduler  0/4 nodes are available: 1 node(s) didn't find available persistent volumes to bind, 3 node(s) had taints that the pod didn't tolerate.

# oc describe  pvc mongodb

Name:          mongodb
Namespace:     openshift
StorageClass:  local-sc
Status:        Pending
Volume:        
Labels:        app=mongodb-persistent
               app.kubernetes.io/component=mongodb-persistent
               app.kubernetes.io/instance=mongodb-persistent
               template=mongodb-persistent-template
Annotations:   openshift.io/generated-by: OpenShiftNewApp
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:      
Access Modes:  
VolumeMode:    Filesystem
Mounted By:    mongodb-1-2lw55
Events:
  Type    Reason                Age               From                         Message
  ----    ------                ----              ----                         -------
  Normal  WaitForFirstConsumer  2s (x5 over 48s)  persistentvolume-controller  waiting for first consumer to be created before binding

Environment

  • Red Hat OpenShift Container Platform 4.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content