Skip to content

Storage Configuration

Aleksei Sviridkin edited this page Apr 22, 2025 · 1 revision

Storage Configuration

This cluster implements multiple storage solutions to address different use cases.

Overview

Two primary storage systems are configured:

  1. Longhorn: Distributed block storage for high availability
  2. NFS CSI Driver: For connecting to external NFS shares

Longhorn Storage

Longhorn provides distributed, replicated block storage across the cluster nodes.

Key Features

  • Data replication across multiple nodes
  • Snapshot and backup capabilities
  • Web UI for storage management
  • Volume expansion
  • Built-in monitoring

Deployment

Longhorn is deployed through ArgoCD using the manifests in the appropriate directory. The setup includes:

  • StorageClass for dynamic provisioning
  • Default storage policy
  • Ingress for the dashboard

Usage

To use Longhorn storage in applications, specify the storage class:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: example-pvc
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: longhorn
  resources:
    requests:
      storage: 1Gi

For more information, visit the Longhorn documentation.

NFS CSI Driver

The NFS CSI Driver enables connecting to external NFS shares.

Deployment

The NFS CSI Driver is deployed via manifests in the manifests/csi-driver-nfs directory:

csi-driver-nfs/
├── daemonset.yaml    # Node driver components
├── deployment.yaml   # Controller components
├── rbac.yaml         # Permissions
└── storageclass.yaml # NFS storage class definitions

Configuration

The NFS storage class configuration maps to your external NFS servers:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: nfs-csi
provisioner: nfs.csi.k8s.io
parameters:
  server: 192.168.1.100  # Your NFS server IP
  share: /exports         # Export path
  # Additional parameters as needed

Usage

To use NFS storage, reference the nfs-csi storage class:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: nfs-pvc
spec:
  accessModes:
    - ReadWriteMany  # NFS supports multi-read/write
  storageClassName: nfs-csi
  resources:
    requests:
      storage: 5Gi

For more information, visit the Kubernetes CSI NFS Driver documentation.

Storage Class Selection

Choose the appropriate storage class based on your needs:

  • Longhorn: For data requiring high availability and replication
  • NFS: For shared read-write access or connecting to existing data

Backups

For Longhorn volumes, use Longhorn's built-in backup functionality:

  1. Access the Longhorn UI
  2. Configure a backup target (S3, NFS)
  3. Create scheduled or manual backups

For NFS volumes, backups should be handled at the NFS server level.

Performance Considerations

  • Longhorn: Performance depends on network speed between nodes
  • NFS: Performance depends on NFS server capabilities and network

Troubleshooting

Common issues:

  1. PVC Stuck in Pending:

    • Check storage class existence: kubectl get sc
    • Verify provisioner pods: kubectl get pods -n longhorn-system or kubectl get pods -l app=csi-nfs-controller
  2. I/O Errors:

    • For Longhorn: Check replica health in Longhorn UI
    • For NFS: Verify NFS server connectivity and exports

For more detailed troubleshooting, see the documentation links at the end of this page.

Documentation Links

Clone this wiki locally