Configure Persistent Storage with Local Path Provisioner

This guide will walk you through deploying local path provisioner and enabling the rok-local-path storage class. You can either use

  • a shared file system across all nodes (NFS) or
  • a common path under all nodes (under rootfs, a dedicated file system on RAID, etc.)

What You’ll Need

Procedure

  1. Go to your GitOps repository, inside your rok-tools management environment:

    root@rok-tools:~# cd ~/ops/deployments
  2. Specify the path under which local path provisioner will create Persistent Volumes. Choose one of the following options based on whether you have a shared or a local path:

    root@rok-tools:~/ops/deployments# export LOCAL_PATH_PROVISIONER_PATH=/mnt/arrikto/local-path-provisioner
    root@rok-tools:~/ops/deployments# export LOCAL_PATH_PROVISIONER_PATH=/mnt/shared

    Important

    Make sure that everything under this path gets persisted across reboots. For example, if your nodes are managed by Bright Cluster Manager, follow these steps to exclude this path from being wiped out across reboots:

    1. Go to Grouping -> Categories -> default (or the category of the worker nodes).
    2. Add the path, for example, /mnt/arrikto/* in both of the following lists:
      • Exclude list sync install
      • Exclude list update

    This is necessary if the path is under rootfs. If the path is provisioned dynamically by Rok Disk Manager, e.g., on top of local NVMe devices, no action is required.

  3. Configure the local-path-provisioner component to use the given path. Choose one of the following options based on whether you have a shared or a local path:

    root@rok-tools:~/ops/deployments# j2 \ > -o rok/local-path-provisioner/components/local/patches/path.yaml \ > rok/local-path-provisioner/components/local/patches/path.yaml.j2
    root@rok-tools:~/ops/deployments# j2 \ > -o rok/local-path-provisioner/components/shared/patches/path.yaml \ > rok/local-path-provisioner/components/shared/patches/path.yaml.j2
  4. Enable the corresponding component. Choose based on whether you have a shared or a local path:

    Edit rok/local-path-provisioner/overlays/deploy/kustomization.yaml and enable the local component:

    components: - ../../components/local

    Edit rok/local-path-provisioner/overlays/deploy/kustomization.yaml and enable the shared component:

    components: - ../../components/shared
  5. Commit your changes:

    root@rok-tools:~/ops/deployments# git commit \ > -am "Configure Persistent Storage with Local Path Provisioner"
  6. Apply the kustomization:

    ooot@rok-tools:~/ops/deployments# rok-deploy --apply \ > rok/local-path-provisioner/overlays/deploy

Verify

  1. Go to your GitOps repository, inside your rok-tools management environment:

    root@rok-tools:~# cd ~/ops/deployments
  2. Verify that local-path-provisioner is up-and-running. Verify that field READY is 1/1:

    root@rok-tools:~/ops/deployments# kubectl get deploy -n rok-local-path-storage NAME READY UP-TO-DATE AVAILABLE AGE local-path-provisioner 1/1 1 1 1m
  3. Ensure that the rok-local-path StorageClass is available:

    root@rok-tools:~/ops/deployments# kubectl get sc rok-local-path NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE rok-local-path local-path.arrikto.com Delete WaitForFirstConsumer false 1m
  4. Optional

    Create a PVC using rok-local-path StorageClass and an NGINX Pod that will use it.

    1. Apply the manifest:

      rok@rok-tools:~/ops/deployments# kubectl apply -f rok/rok-test/rok-verify-pvc.yaml
    2. Ensure that the PVC gets bound. Verify that field STATUS is Bound:

      rok@rok-tools:~/ops/deployments# kubectl get pvc task-pv-claim NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE task-pv-claim Bound pvc-7d18323b-4ed2-4cb9-947f-923e6d54bb96 3Gi RWO rok-local-path 1m
    3. Ensure that the Pod is up-and-running. Check the Pod status and verify that field READY is 1/1 and field STATUS is Running:

      rok@rok-tools:~/ops/deployments# kubectl get pods task-pv-pod NAME READY STATUS RESTARTS AGE task-pv-pod 1/1 Running 0 1m
    4. Clean up the created resources:

      rok@rok-tools:~/ops/deployments# kubectl delete -f rok/rok-test/rok-verify-pvc.yaml

What’s Next

The next step is to deploy Rok.