July 2018
Intermediate to advanced
504 pages
11h 34m
English
Previously, we requested a persistent storage by creating PVCs, and now we are going to create an application using corresponding PVCs, as they are now bound to PVs that are backed by real storage. OpenShift allows developers to create a Pod and use PVC as a volume. The following example shows how it can be used in order to create an Apache-based container:
# cat pod-webserver.yamlapiVersion: v1kind: Podmetadata: name: mywebserverpod labels: name: webeserverspec: containers: - name: webserver image: docker.io/centos/httpd ports: - name: web containerPort: 80 volumeMounts: - name: volume-webroot mountPath: /var/www/html volumes: - name: volume-webroot persistentVolumeClaim: claimName: pvc-web
In the ...