In this lab you will learn how to create persistent volume (PV) using Azure Disk storage.
Before creating PV on openshift, you will have make sure the Azure storageclass is setup. The StorageClass resource object is created by cluster-admin. It provides a mean to pass parameter for dynamic provision storage on demand.
Here is an example Azure unmanaged disk storageclass YAML file. Create a storageclass.yaml file with the following information:
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: azure-storageclass
provisioner: kubernetes.io/azure-disk
parameters:
storageAccount: pocadmin
Note: pocadmin is the storage account on Azure
Run the follow command with the file that was created in the previous step.
oc create -f storageclass.yaml
oc annotate storageclass azure-storageclass storageclass.beta.kubernetes.io/is-default-class="true"
Create PVC from OpenShift Web UI
- Login to WebUI https://master:8443
- Create Project
- Create PVC via
Storage
on the left navigation --> create PVC --> select RWO, enter 1G --> clickCreate
Update deployment config to use PVC
- Under the same Project
- Click
catalog
--> enter PHP - Select PHP builder image
- Enter https://github.com/RedHatWorkshops/welcome-php.git
- Deploy the application
- Click
Application
-->Deployments
- Click
Action
-->Add Storage
--> select pvc and add path. - Save.