-->

DEVOPSZONES

  • Recent blogs

    How to check nfs file system is mounted or not in kubernetes

    To check whether the NFS share used by the nfs-subdir-external-provisioner is mounted and in use by your Kubernetes cluster, you can follow these steps:



    Step-by-Step Check

    1. Get the Pod Name of the NFS Provisioner

    kubectl get pods -n kube-system -l app=nfs-subdir-external-provisioner

    2. Inspect the Logs for Mount Info

    kubectl logs <pod-name> -n kube-system

    Look for lines like:

    Mounting NFS volume...

    Or errors like:

    Failed to mount NFS volume...

    3. Exec into the NFS Provisioner Pod

    kubectl exec -it <pod-name> -n kube-system -- sh

    Once inside:

    mount | grep nfs

    or

    df -h | grep nfs

    You should see something like:

    nfs-server:/exported/path on /persistentvolumes type nfs ...

    4. Check Mounted Volumes on a Node

    If you're using hostPath or troubleshooting at the node level:

    ssh <node-name>
    mount | grep nfs

    To Check Persistent Volume Claims (PVCs) Using the NFS Provisioner:

    kubectl get pvc --all-namespaces -o wide

    Look at the STORAGECLASS column and check if it matches your NFS storage class.

    Example:

    • The mount path is typically defined in the nfs-subdir-external-provisioner deployment YAML under:

    yaml
    env:
    - name: NFS_SERVER value: <your-nfs-server> - name: NFS_PATH value: /some/path
    • If the NFS is not mounted correctly, PVCs using this provisioner will be stuck in Pending or pods will throw VolumeMount errors.


    No comments