- Build and install Kubernetes CSI driver for NFS share
When there is a
failed
status inInstall Kubernetes CSI driver
step, as long as one of the nodes reportedok
then continue. Otherwise, try again.
DRIVER_VERSION="v4.4.0"
ansible-playbook "kubernetes/ansible/kubernetes-csi-nfs-install.ansible.yml" --extra-vars="driver_version=${DRIVER_VERSION}"
# Check status
watch kubectl --namespace kube-system get pods -o wide
- Create the storage class
mkdir -p "${HOME}/.kube/manifests/default"
# Set customizations for the local copy
export NFS_HOST="127.0.0.1" # Modify
export NFS_SHARE="/volume1/share" # Modify
# Create local copy of the manifest
envsubst < "kubernetes/namespaces/default/kubernetes-csi-nfs/csi-nfs-storage.yml" > "${HOME}/.kube/manifests/default/csi-nfs-storage.yml"
cat "${HOME}/.kube/manifests/default/csi-nfs-storage.yml"
# Apply the manifest using the local copy
kubectl apply -f "${HOME}/.kube/manifests/default/csi-nfs-storage.yml"
# Check status
kubectl describe StorageClass csi-nfs-storage
- Test the storage configuration
kubectl apply -f "kubernetes/namespaces/default/kubernetes-csi-nfs/csi-nfs-test-pvc.yml"
# Check status
kubectl describe PersistentVolumeClaim csi-nfs-test-pvc
# Check controller logs for any error
kubectl logs --selector app=csi-nfs-controller --namespace kube-system -c nfs
kubectl delete --ignore-not-found=true -f "kubernetes/namespaces/default/kubernetes-csi-nfs/csi-nfs-test-pvc.yml"
- Clean up everything
kubectl delete --ignore-not-found=true -f "${HOME}/.kube/manifests/default/csi-nfs-storage.yml"
DRIVER_VERSION="v4.4.0"
ansible-playbook "kubernetes/ansible/kubernetes-csi-nfs-uninstall.ansible.yml" --extra-vars="driver_version=${DRIVER_VERSION}"