Prepare a file system persistent volume
Prerequisite
-
Create an NFS Server.
-
Export the path.
-
In the example below, the
yaml
file uses the NFS server10.10.10.10
and the exported path is:/my/nfs/volume/path
.
The following example explains how to create a persistent storage for CTE for Kubernetes to guard. Find more information on creating Persistent Volumes at:
Create a Persistent Storage (PV) YAML file description
Note
Replace the dummy entries for path and server with your own working NFS configuration.
nfs-pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs-test-pv
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
storageClassName: nfs
persistentVolumeReclaimPolicy: Retain
mountOptions:
- hard
nfs:
path: /my/nfs/volume/path
server: 10.10.10.10
Create a Persistent Storage Claim (PVC) YAML file description
nfs-claim.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nfs-test-claim
spec:
storageClassName: nfs
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi
Note
The PV name is not referenced in the PVC. This particular claim will claim any PV that matches the requirements.
Apply Persistent Storage YAML files
Type:
kubectl apply -f nfs-pv.yaml
kubectl apply -f nfs-claim.yaml