Skip to content

Instantly share code, notes, and snippets.

@taking
Last active March 10, 2023 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taking/769e16c95aeb1d71c20382327f391af6 to your computer and use it in GitHub Desktop.
Save taking/769e16c95aeb1d71c20382327f391af6 to your computer and use it in GitHub Desktop.

nfs-client-provisioner Installation with Helm

  • nfs-client-provisioner on Kubernetes

Prerequisites

  • Kubernetes 1.20+
  • Helm 3.2.0+

Helm Chart Reference

nfs

install (nfs server)

apt install nfs-kernel-server -y
mkdir -p /shared/nfs
chown -R nobody:nogroup /shared
chmod -R 777 /shared
cat <<EOF >> /etc/exports
/shared/nfs     *(rw,sync,no_root_squash)
EOF

systemctl restart nfs-server
systemctl restart nfs-kernel-server

install (all cluster)

apt install nfs-common

nfs-client-provisioner

Check

showmount -e 192.168.0.200

image

helm update

helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/
helm repo update nfs-subdir-external-provisioner

install

helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner \
    --set nfs.server=192.168.0.200 \
    --set nfs.path=/shared/nfs \
    --set storageClass.defaultClass=true

image

StorageClass

kubectl get sc
kubectl patch storageclass nfs-client -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

image

@taking
Copy link
Author

taking commented Jan 25, 2023

internal_ip="$(hostname -I | awk {'print $1'})"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment