Prerequisite:
- Set up a Cluster of 4 nodes (1 etc/control plane and 3 workers)
- Deploy Latest Longhorn-master
Create StatefulSet/Deployment with single pod with volume attached in RWX mode.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 1 pod.
- Verify that a PVC, ShareManger pod, CRD and volume in Longhorn get created.
- Verify share-manager pod come up healthy.
- Verify there is directory with the name of PVC exists in the ShareManager mount point.
Example -
ls /export/pvc-8c3481c7-4127-47c3-b840-5f41dc9d603e
- Write some data in the pod and verify the same data reflects in the ShareManager.
- Verify the longhorn volume, it should reflect the correct size.
Create StatefulSet/Deployment with more than 1 pod with volume attached in RWX mode.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Verify that 2 volumes in Longhorn get created.
- Verify there is directory with the name of PVC exists in the ShareManager mount point i.e.
export
- Verify that Longhorn UI shows all the pods name attached to the volume.
- Write some data in all the pod and verify all the data reflects in the ShareManager.
- Verify the longhorn volume, it should reflect the correct size.
Create StatefulSet/Deployment with the existing PVC of a RWX volume.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 1 pod.
- Verify that a PVC, ShareManger pod, CRD and volume in Longhorn get created.
- Write some data in the pod and verify the same data reflects in the ShareManager.
- Create another StatefulSet/Deployment using the above created PVC.
- Write some data in the new pod, the same should be reflected in the ShareManager pod.
- Verify the longhorn volume, it should reflect the correct size.
Scale up StatefulSet/Deployment with one pod attached with volume in RWX mode.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 1 pod.
- Write some data in the pod and verify the same data reflects in the ShareManager.
- Scale up the StatefulSet/Deployment.
- Verify a new volume gets created.
- Write some data in the new pod, the same should be reflected in the ShareManager pod.
- Verify the longhorn volume, it should reflect the correct size.
Scale down StatefulSet/Deployment attached with volume in RWX mode to zero.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 1 pod.
- Write some data in the pod and verify the same data reflects in the ShareManager.
- Scale down the StatefulSet/Deployment to zero
- Verify the ShareManager pod gets deleted.
- Verify the volume should be in detached state.
- Create a new StatefulSet/Deployment with the existing PVC.
- Verify the ShareManager should get created and volume should become attached.
- Verify the data.
- Delete the newly created StatefulSet/Deployment.
- Verify the ShareManager pod gets deleted again.
- Scale up the first StatefulSet/Deployment.
- Verify the ShareManager should get created and volume should become attached.
- Verify the data.
Delete the Workload StatefulSet/Deployment attached with RWX volume.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod and verify the same data reflects in the ShareManager.
- Delete the workload.
- Verify the ShareManager pod gets deleted but the CRD should not be deleted.
- Verify the ShareManager.status.state == “stopped”.
kubectl get ShareManager -n longhorn-system
- Verify the volume should be in detached state.
- Create another StatefulSet with existing PVC.
- Verify the ShareManager should get created and volume should become attached.
- Verify the data.
Take snapshot and backup of a RWX volume in Longhorn.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Take a snapshot and a backup.
- Write some more data into the pod.
- Revert to snapshot 1 and verify the data.
Restore a backup taken from a RWX volume in Longhorn.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Take a backup of the RWX volume.
- Restore from the backup and select access mode as
rwx
. - Verify the restored volume has
volume.spec.accessMode
asrwx
. - Create PV/PVC with
accessMode
asrwx
for restored volume or create PV/PVC using Longhorn UI. - Attach a pod to the PVC created and verify the data.
Restore an RWX backup into an RWO volume.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Take a backup of the RWX volume.
- Restore from the backup and select access mode as
rwo
. - Verify the restored volume has
volume.spec.accessMode
asrwo
. - Create a PV and PVC with
accessMode
asrwo
for the restored volume or create them using Longhorn UI. - Attach a pod to the PVC and verify the data.
- Try to attach the PVC to another pod on another node, user should get
multi attach
error.
Restore an RWO backup into an RWX volume.
- Create a PVC with RWO mode using longhorn class by selecting the option
read write once
. - Attach the PVC to a StatefulSet/Deployment with 1 pod.
- Write some data in the pod.
- Take a backup of the RWO volume.
- Restore from the backup and select access mode as
rwx
. - Create a PV and PVC with
accessMode
asrwx
for the restored volume or create them using Longhorn UI. - Verify the restored volume has
volume.spec.accessMode
asrwx
now. - Attach a pod to the PVC and verify the data.
- Attach more pods to the PVC, verify the volume is accessible from multiple pods.
Create PV and PVC using Longhorn UI for RWX/RWO volume
- Create an RWX volume using Longhorn UI.
- Select the volume and create PV/PVC.
- Verify the PV and PVC are created with
rwx
access mode. - Create an RWO volume using Longhorn UI.
- Select the volume and create PV/PVC.
- Verify the PV and PVC are created with
rwo
access mode.
Create RWX DR volume of a RWX volume in Longhorn.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Take a backup of the volume.
- Create a DR volume of the backup by selecting
rwx
in access mode. - Write more data in the pods and take more backups.
- Verify the DR volume is getting synced with latest backup.
- Activate the DR volume, attach it to multiple pods and verify the data.
Create RWO DR volume of a RWX volume in Longhorn.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Take a backup of the volume.
- Create a DR volume of the backup by selecting
rwo
in access mode. - Write more data in the pods and take more backups.
- Verify the DR volume is getting synced with latest backup.
- Activate the DR volume, attach it to a pod and verify the data.
- Try to attach it to multiple pods, it should show
multi attach error
.
Create RWX DR volume of a RWO volume in Longhorn.
- Create a PVC with RWO mode using longhorn class by selecting the option
read write once
. - Attach the PVC to a StatefulSet/Deployment with 1 pod.
- Write some data in the pod.
- Take a backup of the volume.
- Create a DR volume of the backup by selecting
rwx
in access mode. - Write more data in the pod and take more backups.
- Verify the DR volume is getting synced with latest backup.
- Activate the DR volume, attach it to multiple pods and verify the data.
Expand the RWX volume.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Scale down the StatefulSet/Deployment.
- Once the volume is detached, expand the volume.
- Scale up the StatefulSet/Deployment and verify that user is able to write data in the expanded volume.
- Verify the new size of the volume (same approach as in writing the data).
Recurring Backup/Snapshot with RWX volume.
Create a PVC with RWX mode using longhorn class by selecting the option read write many
.
2. Attach the PVC to a StatefulSet/Deployment with 2 pods.
3. Write some data in the pod.
4. Schedule a recurring backup/Snapshot.
5. Verify the recurring jobs are getting created and is taking backup/snapshot successfully.
Deletion of the replica of a Longhorn RWX volume.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Delete one of the replica and verify that the rebuild of replica is working fine.
Data locality with RWX volume.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Enable
Data-locality
- Disable
Node soft anti-affinity
. - Disable the node where the volume is attached for some time.
- Wait for replica to be rebuilt on another node.
- Enable the node scheduling and verify a replica gets rebuilt on the attached node.
Node eviction with RWX volume.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Do a node eviction and verify the data.
Auto salvage feature on an RWX volume.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Crash all the replicas and verify the auto-salvage works fine.
RWX volume with Allow Recurring Job While Volume Is Detached
enabled.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Set a recurring backup and scale down all the pods.
- Verify the volume get attached at scheduled time and backup/snapshot get created.
RWX volume with Toleration.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Detach the volume by scaling down the StatefulSet/Deployment to 0.
- Set some Toleration.
- Wait for the Longhorn pods to be redeployed.
- Scale up the StatefulSet/Deployment back to 2.
- Verify the ShareManager pods have the toleration and annotation updated.
Detach/Delete operation on an RWX volume.
- Detach action on the RWX volume should not work. A detach will temporarily remove the volume then the share manager controller will try to attach it again and restart a new share manager pod.
- On deletion of the RWX volume, the ShareManager CRDs should also get deleted.
Crash instance e manager of the RWX volume
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Crash the instance manager.
- On crashing the IM, the ShareManager pods should be immediately redeployed.
- Based on the setting
Automatically Delete Workload Pod when The Volume Is Detached Unexpectedly
, the workload pods will get redeployed. - On recreating on workload pods, the volume should get attached successfully.
- If
Automatically Delete Workload Pod when The Volume Is Detached Unexpectedly
is disabled, user should see I/O error on the mounted point.
Reboot the ShareManager and workload node
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Reboot the ShareManager node.
- The ShareManager pod should move to another node.
- As the instance e manager is on the same node and based on setting
Automatically Delete Workload Pod when The Volume Is Detached Unexpectedly
, the workload should be redeployed and volume should be available to user. - Reboot the workload node.
- On restart on the node, pods should get attached to the volume. Verify the data.
Power down the ShareManager and workload node.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Power down the ShareManager node.
- The ShareManager pod should move to another node.
- As the instance manager is on the same node and based on the setting
Automatically Delete Workload Pod when The Volume Is Detached Unexpectedly
, the workload should be redeployed and volume should be available to user. - Power down the workload node.
- The workload pods should move to another node based on
Pod Deletion Policy When Node is Down
setting. - Once the pods are up, they should get attached to the volume. Verify the data.
Kill the nfs process in the ShareManager
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Kill the NFS server in the ShareManager pod.
- The ShareManager pod should go into terminate then restarted by the ShareManager controller. The ganesha service pid can be seen by
cat /var/run/ganesha.pid
. - The workload pods should be restarted.
- Verify the data in workload pods.
Delete the ShareManager CRD.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Delete the ShareManager CRD.
- A new ShareManager CRD should be created.
- Workloads should be restarted based on the setting
Automatically Delete Workload Pod when The Volume Is Detached Unexpectedly
.
Delete the ShareManager pod.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Delete the ShareManager pod.
- A new ShareManager pod should be immediately created.
Drain the ShareManager node.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Drain the ShareManager pod node.
- The volume should get detached first, then the shareManager pod should move to another node and Volume should get reattached.
Disk full on the ShareManager node.
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod and make the disk almost full.
- Verify the RWX volume is not failed.
- Verify the creation of snapshot/backup.
- Try to write more data, and the it should error out
no space left
.
Scheduling failure with RWX volume.
- Disable 1 node. Enable
Allow Volume Creation with Degraded Availability
. - Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 1 pod.
- Verify the RWX volume gets created with degraded state.
- Write some data in the pod.
- Enable the node and the volume should become healthy.
- Disable 1 node again and disable
Allow Volume Creation with Degraded Availability
. - Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Verify volume fails to schedule.
Add a node in the cluster.
- Add a node in the cluster.
- Create multiple statefulSet/deployment with RWX volume.
- Verify that the ShareManager pod is able to scheduled on the new node.
Delete a node from the cluster
- Create a PVC with RWX mode using longhorn class by selecting the option
read write many
. - Attach the PVC to a StatefulSet/Deployment with 2 pods.
- Write some data in the pod.
- Delete the ShareManager node from the cluster.
- Verify the ShareManager pod move to new node and volume continues to be accessible.
RWX on SeLinux enabled cluster
- Verify the RWX feature with a Se Linux enabled cluster.
RWX with Linux/SLES OS
- Verify the RWX feature with a cluster of Linux and SLES OS.
RWX with K3s set up
- Set up a K3s cluster and verify the RWX feature.
RWX in Air gap set up.
- Set up an Air gap set up and verify the RWX feature.
RWX in PSP enabled set up.
- Enable PSP in a cluster and verify the RWX feature.