Overview: Store persistent data in Red Hat OpenShift using PVCs
While the development and deployment of microservices receives most of the attention, it’s the data that users are after. Some methods of storing data include using a relational database, using a no-SQL (or document) database, using an object store, and more. One basic method of storing data is to use files; good, old-fashioned, flat files. Using the file system in your Red Hat OpenShift pod is one solution, but doing so comes with this caveat: When you delete the pod, the data is deleted as well.
Not exactly a persistent solution. Kubernetes (and, by extension, OpenShift) addresses this by allowing you to create and use Persistent Volume Claims (PVC). PVCs are volumes that exist outside of your pod but can be mounted and accessed by your pod.
PVCs can be:
- Created
- Updated
- Expanded in size
- Cloned
- Backed up
- Removed
This learning path will demonstrate some of the characteristics and methods of using a PVC.
Prerequisites
You will need the following in order to complete this activity:
- A Developer Sandbox account
- The
oc
command-line interface needs to be installed on your computer - A web browser to access your Developer Sandbox dashboard
- Download or clone the filecontents GitHub repository
What you will do
In this learning path, you will:
- Create a back-end function
- Create a front-end
curl
command loop - Use OpenShift command-line operations
What you will learn
- How to create and use a PVC
How long will this activity take?
- 45-60 minutes
Programming languages
- You don’t need to know any programming languages to complete this task. If you’re interested in viewing the code, the back end is written in Java.
If you need help
- If you get stuck, if something isn’t working, or you simply have questions, you can easily contact us via email at devsandbox@redhat.com.