Create the Persistent Volume and the Persistent Volume Claim

The Kubernetes Persistent Volume (PV) and Persistent Volume Claim (PVC) are used as storage locations for the WebLogic domain homes and log files.

PVs and PVCs are described in YAML files. For each PV, you should create one PV YAML file and one PVC YAML file. In the following example, you will find two YAML file samples, one for the volume and one for the claim.

pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
 name: <domain_name>-oke-pv
 namespace: <domain_name>-ns
spec:
 storageClassName: <service_name>-oke-fss
 capacity:
  storage: 100Gi
 accessModes:
  - ReadWriteMany
 mountOptions:
  - nosuid
 nfs:
  server: <MOUNT_IP>
  path: "/<service_name>"
  readOnly: false
Here:
  • <MOUNT_IP> is the IP of NFS server that is created as part of the stack.
  • <service_name> is the resource_prefix of the stack.
pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
 name: <domain_name>-oke-pvc
 namespace: <domain_name>-ns
spec:
 storageClassName: <service_name>-oke-fss
 accessModes:
 - ReadWriteMany
  resources:
  requests:
  storage: 100Gi
  volumeName: <domain_name>-oke-pv
Use the pv.yaml file to create a PV by running the following command:
$ kubectl apply -f pv.yaml
Use the pvc.yaml file to create a PVC by running the following command:
kubectl apply -f pvc.yaml
Use the following commands to verify:
kubectl get pvc
kubectl get pv
To view the list of storage classes in your cluster, run the following command:
$ kubectl get storageclass