Skip to content

Instantly share code, notes, and snippets.

@crazytaxii
Last active September 25, 2024 06:22
Show Gist options
  • Save crazytaxii/015569be3bb842458ce820adba9eb3e4 to your computer and use it in GitHub Desktop.
Save crazytaxii/015569be3bb842458ce820adba9eb3e4 to your computer and use it in GitHub Desktop.
Deploy NFS server and CSI on Kubernetes
#!/bin/bash
set -e
DRIVER_VERSION="v4.8.0"
main() {
# deploy nfs server
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/nfs-provisioner/nfs-server.yaml
# deploy nfs csi driver
curl -skSL "https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/$DRIVER_VERSION/deploy/install-driver.sh" | bash -s v4.8.0 --
# create storage class
kubectl create -f "https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/refs/tags/$DRIVER_VERSION/deploy/storageclass.yaml"
# make nfs-csi storage class default
kubectl patch storageclass nfs-csi -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment