Chapter 7. Use cases 173
  tolerations:
  - effect: NoSchedule
    key: node.kubernetes.io/memory-pressure
    operator: Exists
  volumes:
  - name: appmongo-ibm-mongodb-dev-datavolume
    persistentVolumeClaim:
      claimName: appmongo-ibm-mongodb-dev-datavolume
The yaml file that is shown in Example 7-15 on page 171 uses the user as uid 10000 that 
refers to the mongo user in our machines. Give access to that user to write files, as shown in 
Example 7-16.
Example 7-16   Permission for user mongo set on the PV
[root@dcocp01 ~]# ls -la /nfsmongofs/mongo
total 8
drwx------. 2 mongo mongo 4096 Nov  9 14:34 .
drwxr-xr-x. 4 root  root  4096 Oct 31 12:28 ..
[root@dcocp01 ~]# id mongo
uid=10000(mongo) gid=10000(mongo) groups=10000(mongo)
[root@dcocp01 ~]#
Finally, to verify customers can access mongodb, expose the port by using the NodePort type, 
as shown in Example 7-17. In our case, we use this type so the service is accessible on the 
external network. Other means of connection also can be used. MongoDB compass client 
can even use SSH tunneling.
Example 7-17   Yaml file for service on the Power Systems cluster
apiVersion: v1
kind: Service
metadata:
  labels:
    app: appmongo-ibm-mongodb-dev
  name: appmongo-ibm-mongodb-dev
spec:
  externalTrafficPolicy: Cluster
  ports:
  - name: ibm-mongodb-dev
    nodePort: 32767
    port: 27017
    protocol: TCP
    targetPort: 27017
  selector:
    app: appmongo-ibm-mongodb-dev
  sessionAffinity: None
  type: NodePort
Applying all yaml files as shown in Example 7-18 makes MongoDB available for connections 
on the node IP address at port 32767.
Example 7-18   Applying yaml files on the POWER OpenShift cluster
[root@dcocp01 daniel]# oc apply -f nfspv.yaml
persistentvolume/appmongo-ibm-mongodb-dev-datavolume created