Quick installation of NFS

Sometimes we will use kubernetes in the local environment. At this time, it is unlikely to want some convenient storage classes similar to those on AWS and other public clouds. At this time, we will generally choose to use Linux NFS to replace these storage volumes of shared clouds

If you don’t need a storage class, you can directly use docker run, but here, because I’m lazy, I hope to automatically get a storage class after NFS is created. In fact, the most convenient is the helm provided by rancher. Note here

NFS client provisioner and NFS server provisioner have different driving modes and the same functions

The external NFS driver of k8s can be divided into two types according to its working mode (as NFS server or NFS client):

NFS client mounts the remote NFS server to the local directory through the built-in NFS driver of k8s; Then use itself as a storage provider and associate it with storage class. When the user creates a corresponding PVC to apply for PV, the provider compares the requirements of PVC with its own attributes. Once satisfied, it creates a subdirectory to which the PV belongs in the locally mounted NFS directory to provide dynamic storage services for pod

NFS server is different from NFS client. This driver does not use k8s NFS driver to mount remote NFS for local redistribution, but directly maps local files into the container, and then uses Ganesha NFSD to provide NFS services; Each time you create a PV, you can directly create the corresponding folder in the local NFS root directory and export the subdirectory. Dynamically providing kubernetes back-end storage volumes with NFS

Unfortunately, I use NFS provisioner here https://github.com/kubernetes-retired/external-storage

There’s nothing to say about clicking directly to install. Note that the default storage path on the node is /srv. As for which node to store, it’s random here, or you can specify it through node name

As you can see, my workload is assigned to 139,

The most convenient point of this method is that you can get the storage class directly

Then we try to install an nginx to use the NFS provider

Then I will create a test file on the / test path using the shell on the pod of nginx

You can see that this file can be found on NFS node

Send a Message