1. env
1.1 K8S SERVER
os: centos7(3.10.0-1160.el7.x86_64)
helm: v3.7.0
k8s: 3 master; 3 node
kubelet-1.18.14 kubeadm-1.18.14 kubectl-1.18.14
docker: containerd.io-1.2.13 docker-ce-19.03.11 docker-ce-cli-19.03.11
1.2 NFS SERVER
[root@nfs-server-01 ~]# ip a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"|awk -F '/' '{print $1}'
192.1.0.21
[root@nfs-server-01 ~]# cat /etc/exports
/data *(rw,sync,no_root_squash)
[root@nfs-server-01 ~]# ps aux|grep nfs
root 960 0.0 0.0 0 0 ? S< 13:40 0:00 [nfsd4_callbacks]
root 969 0.0 0.0 0 0 ? S 13:40 0:00 [nfsd]
root 970 0.0 0.0 0 0 ? S 13:40 0:00 [nfsd]
root 971 0.0 0.0 0 0 ? S 13:40 0:00 [nfsd]
root 972 0.0 0.0 0 0 ? S 13:40 0:00 [nfsd]
root 973 0.0 0.0 0 0 ? S 13:40 0:00 [nfsd]
root 974 0.0 0.0 0 0 ? S 13:40 0:00 [nfsd]
root 975 0.0 0.0 0 0 ? S 13:40 0:01 [nfsd]
root 976 0.0 0.0 0 0 ? S 13:40 0:04 [nfsd]
root 13291 0.0 0.0 112816 960 pts/0 S+ 19:21 0:00 grep --color=auto nfs
2. create nfs-client-provisioner
2.1 get yaml
helm inspect values stable/nfs-client-provisioner
2.2 modify the nfs server nfs path, name of nfs-client.yaml
replicaCount: 3
strategyType: Recreate
image:
repository: quay.io/external_storage/nfs-client-provisioner
tag: v3.1.0-k8s1.11
pullPolicy: IfNotPresent
nfs:
# here
server: 192.1.0.21
path: /data
mountOptions:
storageClass:
create: true
defaultClass: false
# here
name: nfs-client
allowVolumeExpansion: true
reclaimPolicy: Delete
archiveOnDelete: true
accessModes: ReadWriteOnce
rbac:
create: true
podSecurityPolicy:
enabled: false
serviceAccount:
create: true
name:
resources: {}
nodeSelector: {}
tolerations: []
affinity: {}
2.3. install and uninstall
# install
kubectl create namespace elastic
helm install -n elastic nfs-client stable/nfs-client-provisioner -f nfs-client.yaml
# watch
helm list -n elastic
# upgrade
helm upgrade [RELEASE] [CHART] [flags]
helm upgrade -n elastic -f nfs-client.yaml nfs-client stable/nfs-client-provisioner
# uninstall
helm uninstall -n elastic nfs-client
3 create elasticsearch
3.1 get elasticsearch.yaml
helm repo add elastic https://helm.elastic.co
helm show values elastic/elasticsearch > values.yaml
3.2 add storageClassName of values.yaml
# The storageClassName must be consistent with nfs-client-provisioner's name
volumeClaimTemplate:
storageClassName: "nfs-client"
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 30Gi
3.3 install and uninstall
helm install elasticsearch -n elastic -f values.yaml elastic/elasticsearch
helm uninstall elasticsearch -n elastic