July 2018
Intermediate to advanced
504 pages
11h 34m
English
OpenShift users can attach a volume to any running application by using oc volume. In this example, we are going to create a pod with a basic application and attach a persistent volume to it.
First, just deploy a basic Apache web server using oc new-app:
# oc new-app httpd...<output omitted>...
After a little while, all httpd service resources will be available:
# oc get pod | egrep "^NAME|httpd"NAME READY STATUS RESTARTS AGEhttpd-1-qnh5k 1/1 Running 0 49s
oc new-app created a deployment configuration that controls the application deployment process.
In this example, we are going to attach a PVC named pvc-data as a volume to the running container:
# oc volume dc/httpd --add --name=demovolume -t pvc --claim-name=pvc-data ...