Chapter 7. Use cases 167
    deploymentconfig.apps.openshift.io "mongodb-36-rhel7" created
    service "mongodb-36-rhel7" created
--> Success
    Application is not exposed. You can expose services to the outside world by executing 
one or more of the commands below:
     'oc expose svc/mongodb-36-rhel7' 
    Run 'oc status' to view your app.
7. Configure the persistent volume for MongoDB, as shown in Example 7-7.
Example 7-7   MongoDB persistent volume
# cat > mongodb-pvc.yml <<EOF_/mongodb-pvc.yml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: mongodb-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 17Gi
EOF_/mongodb-pvc.yml
# oc get dc
NAME               REVISION   DESIRED   CURRENT   TRIGGERED BY
mongodb-36-rhel7   1          1         1         config,image(mongodb-36-rhel7:latest)
nodejs-ex          1          1         1         config,image(nodejs-ex:latest)
# oc set volume dc/mongodb-36-rhel7
deploymentconfigs/mongodb-36-rhel7
  empty directory as mongodb-36-rhel7-volume-1
    mounted at /var/lib/mongodb/data
# oc create -f mongodb-pvc.yml
persistentvolumeclaim/mongodb-pvc created
# oc get pvc
NAME          STATUS    VOLUME                                     CAPACITY   ACCESS MODES   
STORAGECLASS                     AGE
mongodb-pvc   Bound     pvc-424befe9-0403-11ea-b8f2-fa47ee288120   17Gi       RWO            
ibm-powervc-k8s-volume-default   1m
# oc set volume dc/mongodb-36-rhel7 --add --name=mongodb-storage -t pvc 
--claim-name=mongodb-pvc  --overwrite
warning: volume "mongodb-storage" did not previously exist and was not overriden. A new 
volume with this name has been created 
instead.deploymentconfig.apps.openshift.io/mongodb-36-rhel7 volume updated
# oc set volume dc/mongodb-36-rhel7
deploymentconfigs/mongodb-36-rhel7
  empty directory as mongodb-36-rhel7-volume-1
    mounted at /var/lib/mongodb/data
  pvc/mongodb-pvc (allocated 17GiB) as mongodb-storage
8. Set up the environment variables for the nodejs-ex application, as shown in Example 7-8.
Example 7-8   Setting environment variables
# oc status
In project nodejs (nodejs-example) on server https://ocp.domain.example.com:8443
svc/mongodb-36-rhel7 - 172.30.155.22:27017
  dc/mongodb-36-rhel7 deploys istag/mongodb-36-rhel7:latest