Skip to content

Configuring NFS CSI Driver for Session-State Preservation (NFS v4.1)

Follow these steps to verify server support, enforce mount options, and safely propagate storage changes across your Kubernetes cluster.

Run this command on your NFS server to ensure version 4.1 is active and supported:

Terminal window
cat /proc/fs/nfsd/versions

Add these specific mount options to your Kubernetes StorageClass definition to enable session-state preservation and ensure data integrity:

  • hard: Freezes I/O until the server returns to prevent data corruption.
  • nfsvers=4.1: Enables session-state preservation.
  • timeo=600: Sets the timeout sequence length to 60 seconds.
  • retrans=2: Defines the number of retries before backing off.

3. Rollout Restart the NFS CSI Driver Workloads

Section titled “3. Rollout Restart the NFS CSI Driver Workloads”

Apply the configuration changes by restarting the controller deployment and the node daemonset in the cluster:

Terminal window
kubectl rollout restart deployment csi-nfs-controller -n kube-system
kubectl rollout restart daemonset csi-nfs-node -n kube-system

Ensure the new driver pods are running successfully before proceeding to the storage layer:

Terminal window
kubectl get pods -n kube-system -l app.kubernetes.io/name=csi-driver-nfs

Existing volumes must be rotated sequentially for the new mount options to take effect on your application workloads:

  1. Delete the active PVC associated with the workload.
  2. Delete the associated Pod to trigger a fresh volume attachment.
  3. Wait for the pod to restart, let it provision/assign a new PVC, and copy your data back over.
  4. Repeat this process sequentially for all remaining pods using the storage layer.

Crunchy Data PGO (PostgreSQL Operator) Workloads

Section titled “Crunchy Data PGO (PostgreSQL Operator) Workloads”

To prevent downtime and ensure replication consistency, follow a strict failover order for database clusters:

  1. Target Replica (Slave) Pods First:
    • Delete the PVC for a replica pod.
    • Delete the replica pod.
    • Wait for the replica pod to restart, bind its new PVC, and successfully catch up/sync data from the primary master.
    • Repeat this one-by-one for all replica pods.
  2. Target Primary (Master) Pod Last:
    • Trigger a manual switchover using PGO tools to demote the primary and safely promote a newly updated replica to master.
    • Once demoted, delete the old master PVC and pod.
    • Allow the old master to spin back up as a synchronized replica under the new mount settings.

For Kafka clusters (especially Kraft or Zookeeper-based setups), always upgrade data workers before management planes to prevent cluster partition split-brains:

  1. Target Broker Pods First:
    • Process Kafka brokers one-by-one.
    • Delete the broker PVC and its matching pod.
    • Wait for the broker to restart, attach the new PVC, and completely finish replicating missing partition log segments from the active ISR (In-Sync Replicas) list.
    • Proceed to the next broker only after the current one is reporting fully healthy/synchronized.
  2. Target Controller Pods Last:
    • Once all data brokers are updated, cycle the Kraft controllers one at a time.
    • Delete the controller PVC and pod.
    • Wait for the node to rejoin the quorum before moving to the next controller.

For stateful Dapr system services, cycle the actor placement tracking engine before updating the job scheduling plane to maintain continuous actor routing:

  1. Target Placement Pods First:
    • Delete the PVC and pod for the Dapr placement service.
    • Wait for the placement pod to fully restart, claim its new volume, and reconstruct the actor placement tables.
    • If running a multi-node high-availability placement quorum, cycle them one-by-one.
  2. Target Scheduler Pods Last:
    • Once placement is stable, delete the PVC and pod for the Dapr scheduler service.
    • Allow the scheduler to restart and re-sync its scheduled jobs and reminders under the updated storage configuration.

After recreating the PVCs, the old Persistent Volumes (PVs) will be left in a Released status if your StorageClass reclaim policy is set to Retain. These must be cleaned up to prevent stale resource accumulation.

  1. Navigate to your cluster in the Rancher Dashboard.
  2. In the left navigation menu, expand Storage and click on PersistentVolumes.
  3. Sort the list by the Status column to find all volumes marked as Released.
  4. Select the orphaned Released volumes.
  5. Click Delete at the top or use the three-dot action menu to remove them.

Alternatively, identify and purge the Released volumes directly using the terminal:

Terminal window
# List all PVs with a Released status
kubectl get pv | grep Released
# Delete specific released volumes
kubectl delete pv <released-pv-name>