Skip to Content
Learn OpenShift
book

Learn OpenShift

by Denis Zuev, Artemii Kropachev, Aleksey Usov
July 2018
Intermediate to advanced
504 pages
11h 34m
English
Packt Publishing
Content preview from Learn OpenShift

Managing volumes through oc volume

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Operating OpenShift

Operating OpenShift

Rick Rackow, Manuel Dewald
OpenShift for Developers, 2nd Edition

OpenShift for Developers, 2nd Edition

Joshua Wood, Brian Tannous
Kubernetes: Up and Running, 2nd Edition

Kubernetes: Up and Running, 2nd Edition

Brendan Burns, Joe Beda, Kelsey Hightower

Publisher Resources

ISBN: 9781788992329Supplemental Content