Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use NFS to build dynamic Storage Volume in kubernetes

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article shows you how to use NFS to build dynamic storage volumes in kubernetes. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Installation environment installs kubernetes, helm

See Resources for installing kubernetes and helm on node1 and node2

Install NFS

Install NFS Server on node1

$sudo yum-y install nfs-utils rpcbind

Configure a shared directory on the server node1

$sudo mkdir / var/nfs$ sudo su / / switch to the root user $echo "/ var/nfs 192.168.0 rw,async,no_root_squash,no_all_squash,sync" > > / etc/exports / / configure the shared directory $exit / / return the original user $exportfs-r / / to make the above configuration effective

Start the NFS service on the server side

/ / you must start the rpcbind service first, and then start the nfs service, so that the nfs service can successfully register $sudo systemctl start rpcbind$ sudo systemctl start nfs-server with the rpcbind service

Check whether the service starts successfully

$showmount-e localhostExport list for localhost:/var/nfs 192.168.0.

Set up boot boot

$sudo systemctl enable rpcbind$ sudo systemctl enable nfs-server installs nfs-utils on the client node2

* * Note: all kubernetes machines need to install nfs-utils. I just didn't install nfs-utils on the client side, so I got stuck in how to test PV, StorageClass and PVC.

$sudo yum install nfs-utils

You can refer to the resources to test NFS shared storage on the customer server.

NFS as a dynamic storage volume

See Resources for installing NFS-Client Provisioner using helm on node1

$helm install stable/nfs-client-provisioner-set nfs.server=x.x.x.x-set nfs.path=/exported/path-name nfs-client-provisioner

It will install a StorageClass

$kubectl get scNAME PROVISIONER AGEnfs-client cluster.local/nfs-client-provisioner 32h sets the default StorageClass

When using PVC, you need to create and specify PV;. If no PV is created, the default StorageClass will be used to create the corresponding PV;. Otherwise, PVC will always be the state of Pending.

Set the above creation StorageClass as the default

$kubectl patch storageclass nfs-client-p'{"metadata": {"annotations": {"storageclass.kubernetes.io/is-default-class": "true"}}'$kubectl get scNAME PROVISIONER AGEnfs-client (default) cluster.local/nfs-client-provisioner 32h the above is how to use NFS to build dynamic storage volumes in kubernetes. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report