Storage Provisioning for K3s
We have gone trough quite a lot of hassle building our cluster. If we came this far, is time to enjoy its full potential. During the series, we will deploy multiple services, one of which for starters, storage provisioners. When we want to serve web content, we need multiple pods on different nodes, to be able to access the same folder where our web content is stored (ex. /var/www/html) at the same time. To accomplish this, we will use an NFS share, accessible from every node in our cluster. The storage provisioner will take care of providing and mounting persistent storage to each pod. Clone the repo :
Navigate to the external-storage/nfs-clientfolder. Edit the contents of the deploy/deployment-arm.yaml file to adapt to your NFS server, change the PROVISIONER_NAME value to e.g. nfs-storage, change the NFS_SERVER value to your NFS server IP-address and the NFS_PATH value to suite your NFS server. NOTE: 5 lines in total should be modified.Edit the contents of the deploy/class.yaml file and change the provisioner: to what you used for PROVISIONER_NAME value above. The deploy/rbac.yaml file contains config needed for role based access control. Time to apply the 3 yaml-files:
We still have the database part to deal with. Ensuring high availability and performance will be a priority. For replicated local storage provisioner, the best fit with K3s ended up with Longhorn. Install Helm
Fetch the latest charts from the repository: Install Longhorn in the longhorn-system namespace. To install Longhorn with Helm 2, use this command:helm install longhorn/longhorn --name longhorn --namespace longhorn-system
git clone https://github.com/longhorn/longhorn
kubectl create namespace longhorn-system
helm install longhorn ./longhorn/chart/ --namespace longhorn-system