#添加helm源
helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner
#创建个namespace(可选,主要是为了查看资源方便)
kubectl create ns nfs-sc-default
#使用helm安装(10.1.129.86为NFS地址,/home/data/nfs-share/为共享的目录)
helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner \
--set storageClass.name=nfs-sc-default #指定sc的名字
--set nfs.server=10.10.10.99 \ #指定nfs地址
--set nfs.path=/home/data/nfs-share/ \ #指定nfs的共享目录
--set storageClass.defaultClass=true \ #指定为默认sc
-n default #指定命名空间
#查看创建的sc
kubectl get sc
https://www.whuanle.cn/archives/21206
第二种、
#下载chart
helm pull nfs-subdir-external-provisioner/nfs-subdir-external-provisioner
#解压后可以看到values.yaml
cat values.yaml | egrep -v '#|^$'
replicaCount: 1
strategyType: Recreate
image:
repository: registry.k8s.io/sig-storage/nfs-subdir-external-provisioner
tag: v4.0.2
pullPolicy: IfNotPresent
imagePullSecrets: []
nfs:
server:
path: /home/data/nfs-share
mountOptions:
volumeName: nfs-subdir-external-provisioner-root
# Reclaim policy for the main nfs volume
reclaimPolicy: Retain
# For creating the StorageClass automatically:
storageClass:
create: true
# Set a provisioner name. If unset, a name will be generated.
# provisionerName:
# Set StorageClass as the default StorageClass
# Ignored if storageClass.create is false
defaultClass: true
# Set a StorageClass name
# Ignored if storageClass.create is false
name: nfs-client
# Allow volume to be expanded dynamically
allowVolumeExpansion: true
# Method used to reclaim an obsoleted volume
reclaimPolicy: Delete
# When set to false your PVs will not be archived by the provisioner upon deletion of the PVC.
archiveOnDelete: true
# If it exists and has 'delete' value, delete the directory. If it exists and has 'retain' value, save the directory.
# Overrides archiveOnDelete.
# Ignored if value not set.
onDelete:
# Specifies a template for creating a directory path via PVC metadata's such as labels, annotations, name or namespace.
# Ignored if value not set.
pathPattern:
# Set