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¶
- A configured management environment.
- Your clone of the Arrikto GitOps repository.
- An existing Kubernetes cluster.
Procedure¶
Go to your GitOps repository, inside your
rok-tools
management environment:root@rok-tools:~# cd ~/ops/deploymentsSpecify 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-provisionerroot@rok-tools:~/ops/deployments# export LOCAL_PATH_PROVISIONER_PATH=/mnt/sharedImportant
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:
- Go to Grouping -> Categories -> default (or the category of the worker nodes).
- 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.
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.j2root@rok-tools:~/ops/deployments# j2 \ > -o rok/local-path-provisioner/components/shared/patches/path.yaml \ > rok/local-path-provisioner/components/shared/patches/path.yaml.j2Enable 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 thelocal
component:components: - ../../components/localEdit
rok/local-path-provisioner/overlays/deploy/kustomization.yaml
and enable theshared
component:components: - ../../components/sharedCommit your changes:
root@rok-tools:~/ops/deployments# git commit \ > -am "Configure Persistent Storage with Local Path Provisioner"Apply the kustomization:
ooot@rok-tools:~/ops/deployments# rok-deploy --apply \ > rok/local-path-provisioner/overlays/deploy
Verify¶
Go to your GitOps repository, inside your
rok-tools
management environment:root@rok-tools:~# cd ~/ops/deploymentsVerify 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 1mEnsure 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 1mOptional
Create a PVC using
rok-local-path
StorageClass and an NGINX Pod that will use it.Apply the manifest:
rok@rok-tools:~/ops/deployments# kubectl apply -f rok/rok-test/rok-verify-pvc.yamlEnsure 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 1mEnsure 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 1mClean up the created resources:
rok@rok-tools:~/ops/deployments# kubectl delete -f rok/rok-test/rok-verify-pvc.yaml