Step-by-Step: Adding NFS Storage to Your Kubernetes Cluster
HTML-код
- Опубликовано: 10 июл 2024
- #kubernetes #microk8s #homeserver #synology
In this video, we'll show you how to expand the capabilities of a Kubernetes cluster by adding shared storage. We'll be upgrading a home cluster by connecting a Synology NAS as an NFS server that can serve read-write-many persistent volumes.
But before we get into the demo, we'll explain why you would want to do this and the downsides of sticking with the default storage that comes with a Kubernetes cluster.
Kubernetes running on nodes are really designed to provide only compute resources. This means that if your compute workload needs to store things to a disk for anything other than temporary usage, it’ll need some place else to store that data.
On Kubernetes, that means declaring persistent volumes in the definition of your app. The issue though, that we start to run into immediately is the location and the availability of those requested storage volumes.
In this video, we'll show you how to solve this problem using the Kubernetes NFS provisioner (or NFS container storage interface). NFS servers have been around for forever and have provided a simple way for multiple workloads to connect to one disk. It even allows both workloads to read and write simultaneously. The NFS CSI allows a multi-node Kubernetes cluster to create and mount volumes that are backed by NFS. Installing and configuring the CSI is a one-time thing and after that, it's completely transparent to users of the cluster.
We'll walk you through the steps and show you how to set up a Kubernetes cluster to use NFS for provisioning volumes. The very first thing we need to do is have an NFS server. There are a bunch of ways to do this, and we'll show you two of them - adding NFS to one of your Kubernetes nodes or using a separate device for running NFS.
Follow along with us as we demonstrate how to set up a Kubernetes cluster with shared storage, allowing for greater flexibility and scalability in your workloads.
Products and software:
Synology NAS: amzn.to/3LguVpW
Disk: amzn.to/3ZXiSSG
Mac Mini: amzn.to/3ZYcjzl
TP Link switch: amzn.to/3LjtO9i
Riser: amzn.to/3YAiTLi
MicroK8s NFS Setup: microk8s.io/docs/nfs
Kubernetes CSI repo: github.com/kubernetes-csi
=======================================
I get a lot of questions about my gear so I've created a few lists of the stuff I use. These are affiliate links. If you click and literally buy anything, it helps support the channel! Thank you.
Here's a link to my home office gear: kit.co/AskCloudArchitech/my-h...
Here's a link to my youtube "studio" gear: kit.co/AskCloudArchitech/yout...
=======================================
My website for written versions of these vids: askcloudarchitech.com
==============================================================
00:00 - Intro
00:29 - Purpose of Kubernetes Storage Volumes
01:37 - Challenges with k8s Hostpath Volumes
03:15 - About the kubernetes NFS CSI
03:43 - Two ways to Add NFS
03:57 - Adding NFS to one of your nodes
04:31 - Setting up NFS on NAS
05:01 - Synology NAS NFS setup
05:28 - Installing the NFS CSI driver
06:07 - How to add a NFS Storage Class
08:01 - Creating a Persistent Volume Claim
08:39 - Adding a PVC to your deployment Хобби
English is not my main language, but your video was very easy to follow. Thank you and continue
Great vid ! Clear and work out of the box !
Thanks!
Great Video well done, thank you for your hard work. I needed this thank you.
Thanks! I really liked making this one and I still use this setup exactly how it is in this video
Thanks! Very helpful.
Wow! Thank you so much !
Great Video!!!!!!!!!!!!!
thanks!
Thanks!
Great video! concepts well explained and clear instructions. I'm wondering how we can add permissions for editing and reading?
Great, Thank You!
What if you had to secure the NFS volume?
Any idea on how to go about that?
Secure at what layer?
@@LearnFastMakeThingsI did it on layer 3 now.
Only the nodes are allowed to access the nfs volume.
Manage to make a pvc and pv on the nfs. But somehow can’t make a pod use it. I suspect due to nfs permission as the log say “can not mount file system is read only@
Yes. It sound like you need to configure your pvc to be read write many. By default only one mount can have write access
What's the difference if I just use volumes and volumeMounts on my deployment object?
While you can mount volumes directly from the deployment it has some downsides. PVCs are a more reusable and generic way of getting a volume without necessarily knowing the underlying infrastructure. Also when just using volumes without a pvc, you may lose the data when you delete the deployment. With pvc on the other hand the data is retained when the deployment is deleted and you can just reattach to the pvc.
Hi, please how can you pinpoint me to some tutorial how to install CSI driver on K3s? :)
I read on this a little bit and it seems installation on k3s is the same as how you would do it for any normal Kubernetes cluster. So I’d recommend using the helm chart. github.com/kubernetes-csi/csi-driver-nfs/blob/master/charts/README.md
First Like!! 😅
First Comment!!*
*Edit.
Legend!