Create Storage Class¶
F5 recommends creating a Kubernetes Storage Class using Network File System (NFS) with ReadWriteMany (RWX) access mode. This recommendation exists because TMMs and Observer pods, which collect and aggregate metrics across all TMM pods, always run on separate nodes. Due to this distributed architecture, using local storage is not practical.
The F5 Lifecycle Operator (FLO) automatically defines the Persistent Volume Claim (PVC) with RWX access and its associated naming, after which Kubernetes dynamically creates the Persistent Volume (PV) using the available storage classes. These persistent volumes ensure important data such as core dumps, stats, and other essential files are consistently available—even across pod reboots or node restarts.For more information on Storage Class, see Storage Classes.
To create the Storage Class, follow the instructions below:
Install CSI Driver for NFS.
helm repo add csi-driver-nfs https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/charts
helm install csi-driver-nfs csi-driver-nfs/csi-driver-nfs --namespace kube-system --set kubeletDir=/var/lib/kubelet
List the available CSI drivers in your Kubernetes cluster.
kubectl get pods --selector app.kubernetes.io/name=csi-driver-nfs --namespace kube-system
Sample Output
NAME READY STATUS RESTARTS AGE csi-nfs-controller-7dfdf8bb86-h6b2q 5/5 Running 0 32h csi-nfs-node-9s784 3/3 Running 0 32h csi-nfs-node-ccld9 3/3 Running 0 32h
List the available CSI drivers in your Kubernetes cluster.
kubectl get csidrivers
Sample Output
NAME ATTACHREQUIRED PODINFOONMOUNT STORAGECAPACITY TOKENREQUESTS REQUIRESREPUBLISH MODES AGE nfs.csi.k8s.io false false false <unset> false Persistent 32h
Create a
storageclass.yaml
file with the example content below.allowVolumeExpansion: true apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: annotations: kubectl.kubernetes.io/last-applied-configuration: | {"allowVolumeExpansion":true,"apiVersion":"storage.k8s.io/v1","kind":"StorageClass","metadata":{"annotations":{},"name":"nfs"},"parameters":{"server":"10.144.73.141","share":"/titan"},"provisioner":"nfs.csi.k8s.io","reclaimPolicy":"Delete","volumeBindingMode":"Immediate"} storageclass.kubernetes.io/is-default-class: "true" name: nfs parameters: share: server: provisioner: nfs.csi.k8s.io reclaimPolicy: Delete volumeBindingMode: Immediate mountOptions: - hard - nfsvers=4.0
Before you apply the
storageclass.yaml
, make sure to update the file with actual values for the below parameters.Update
parameters.share
with path where PVCs are to be created.Update
parameters.server
with external NFS server.
Apply the
storageclass.yaml
.kubectl apply -f storageclass.yaml
Check the created Storage Class.
kubectl get storageclass
Sample Output
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE nfs (default) nfs.csi.k8s.io Delete Immediate true 31h
Patch the NFS Storage Class to make it default to ensure that the NFS storage class is used by default for all storage-related operations.
kubectl patchstorageclass nfs -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
Verify the NFS Storage Class.
kubectl get storageclass
Sample Output
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE local-path rancher.io/local-path Delete WaitForFirstConsumer false 12d nfs (default) nfs.csi.k8s.io Delete Immediate true 12d