[root@k8s-master ~]# helm repo add stable http://mirror.azure.cn/kubernetes/charts
"stable" has been added to your repositories
[root@k8s-master ~]# helm repo list
NAME URL
stable http://mirror.azure.cn/kubernetes/charts
3.创建storageclass与nfs的目录相关联
[root@k8s-master ~]# helm install nfs-redis stable/nfs-client-provisioner --set nfs.server=192.168.22.134 --set nfs.path=/nfsdata
WARNING: This chart is deprecated
NAME: nfs-redis
LAST DEPLOYED: Tue Aug 6 16:01:14 2024
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
[root@k8s-master ~]# helm list
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
nfs-redis default 1 2024-08-06 16:01:14.424540014 +0800 CST deployed nfs-client-provisioner-1.2.11 3.1.0
[root@k8s-master ~]# kubectl get pod
NAME READY STATUS RESTARTS AGE
nfs-redis-nfs-client-provisioner-7bd85b55f4-p26ks 1/1 Running 0 39s
[root@k8s-master ~]# kubectl get sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
nfs-client cluster.local/nfs-redis-nfs-client-provisioner Delete Immediate true 53s
三、redis配置文件configmap
[root@k8s-master redis]# vim redis.conf
[root@k8s-master redis]# cat redis.conf
appendonly yes
cluster-enabled yes
cluster-config-file /var/lib/redis/nodes.conf
cluster-node-timeout 5000
dir /var/lib/redis
port 6379
[root@k8s-master redis]# kubectl create configmap redis-conf --from-file=redis.conf
configmap/redis-conf created
[root@k8s-master redis]# kubectl get cf
error: the server doesn't have a resource type "cf"
[root@k8s-master redis]# kubectl get cm
NAME DATA AGE
redis-conf 1 19s