sudo helm repo add csi-driver-nfs https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/charts
Hasil output
root@k3s-node-01:~# helm repo add csi-driver-nfs https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/charts "csi-driver-nfs" has been added to your repositories root@k3s-node-01:~#
sudo helm install csi-driver-nfs csi-driver-nfs/csi-driver-nfs --namespace kube-system --version v4.6.0 NAME: csi-driver-nfs
Hasil output
root@k3s-node-01:~# helm install csi-driver-nfs csi-driver-nfs/csi-driver-nfs --namespace kube-system --version v4.6.0 NAME: csi-driver-nfs LAST DEPLOYED: Sat Feb 17 13:04:58 2024 NAMESPACE: kube-system STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: The CSI NFS Driver is getting deployed to your cluster. To check CSI NFS Driver pods status, please run: kubectl --namespace=kube-system get pods --selector="app.kubernetes.io/instance=csi-driver-nfs" --watch root@k3s-node-01:~#
Check status deployment NFS csi
root@k3s-node-01:~# kubectl --namespace=kube-system get pods --selector="app.kubernetes.io/instance=csi-driver-nfs" --watch NAME READY STATUS RESTARTS AGE csi-nfs-controller-675d96678c-ql7t2 0/4 ContainerCreating 0 12s csi-nfs-node-pt4rj 0/3 ContainerCreating 0 12s csi-nfs-node-sfrs8 0/3 ContainerCreating 0 12s csi-nfs-node-xjm7j 0/3 ContainerCreating 0 12s csi-nfs-node-pt4rj 3/3 Running 0 17s csi-nfs-controller-675d96678c-ql7t2 4/4 Running 0 17s csi-nfs-node-sfrs8 3/3 Running 0 17s csi-nfs-node-xjm7j 3/3 Running 0 17s ^Croot@k3s-node-01:~#
Melakukan konfigurasi storage class
--- apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: nfs-csi provisioner: nfs.csi.k8s.io parameters: server: {alamatnya} share: /{pathnya/ # csi.storage.k8s.io/provisioner-secret is only needed for providing mountOptions in DeleteVolume # csi.storage.k8s.io/provisioner-secret-name: "mount-options" # csi.storage.k8s.io/provisioner-secret-namespace: "default" reclaimPolicy: Delete volumeBindingMode: Immediate allowVolumeExpansion: true mountOptions: - nfsvers=4.1
Contoh
--- apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: nfs-csi provisioner: nfs.csi.k8s.io parameters: server: 192.168.68.24 share: /data-windows/rancher/nfs-share # csi.storage.k8s.io/provisioner-secret is only needed for providing mountOptions in DeleteVolume # csi.storage.k8s.io/provisioner-secret-name: "mount-options" # csi.storage.k8s.io/provisioner-secret-namespace: "default" reclaimPolicy: Delete volumeBindingMode: Immediate allowVolumeExpansion: true mountOptions: - nfsvers=4.1