Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NFS PV mountOptions does not work when Volume SubPath option is set #124863

Open
skanakal opened this issue May 14, 2024 · 2 comments
Open

NFS PV mountOptions does not work when Volume SubPath option is set #124863

skanakal opened this issue May 14, 2024 · 2 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/storage Categorizes an issue or PR as relevant to SIG Storage. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@skanakal
Copy link

What happened?

Setting the Volume subpath option at deployment with an NFS PV with a mount option (e.g. nosuid) does not mount accordingly. If no SubPath is set and the NFS PV is set to the /nfs_share/directory the mount works with the nosuid.

What did you expect to happen?

should be mounted with correct mountoptions

How can we reproduce it (as minimally and precisely as possible)?

  • create KIND cluster and install nfs client packages
  • create a PV and PVC with below options:
spec:
  accessModes:
    - ReadWriteOnce
    - ReadOnlyMany
    - ReadWriteMany
  capacity:
    storage: 10Gi
  claimRef:
    apiVersion: v1
    kind: PersistentVolumeClaim
    name: pvc01
    namespace: default
    resourceVersion: '53505'
    uid: 0b3736ac-bbb6-4539-95c1-854ddcb36114
  mountOptions:
    - nfsvers=4.2
    - sec=sys
    - nosuid
  nfs:
    path: /nfs
    server: 172.31.40.82
  persistentVolumeReclaimPolicy: Retain
  volumeMode: Filesystem  
  • Update the deployment with the volume and mount information:
          volumeMounts:
            - mountPath: /data
              name: vol-oirnd
              subPath: share01

      volumes:
        - name: vol-oirnd
          persistentVolumeClaim:
            claimName: pvc01
          __newPvc:
            type: persistentvolumeclaim
            metadata:
              namespace: default
            spec:
              storageClassName: ''
              volumeName: ''
              resources:
                requests: {} 

Anything else we need to know?

**Not using SubPath**

root@kind-2-control-plane:/# mount | grep nfs
192.168.100.217:/nfs on /var/lib/kubelet/pods/c29b33d8-3709-4082-892c-def5efbba86f/volumes/kubernetes.io~nfs/pv type nfs4 (rw,nosuid,relatime,vers=4.2,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=172.18.0.2,local_lock=none,addr=192.168.100.217)

**When not using SubPath**


192.168.100.217:/nfs/hello/world on /var/lib/kubelet/pods/c29b33d8-3709-4082-892c-def5efbba86f/volume-subpaths/pv/httpd/0 type nfs4 (rw,relatime,vers=4.2,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=172.18.0.2,local_lock=none,addr=192.168.100.217)
root@kind-2-control-plane:/# 

root@kind-2-control-plane:/# kubectl get nodes
NAME                   STATUS   ROLES           AGE   VERSION
kind-2-control-plane   Ready    control-plane   49m   v1.29.2
root@kind-2-control-plane:/# 

Kubernetes version

$ kubectl version
 v1.29.2

Cloud provider

OS version

# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
Ubuntu

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here

Install tools

Container runtime (CRI) and version (if applicable)

Related plugins (CNI, CSI, ...) and versions (if applicable)

@skanakal skanakal added the kind/bug Categorizes issue or PR as related to a bug. label May 14, 2024
@k8s-ci-robot k8s-ci-robot added needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 14, 2024
@carlory
Copy link
Member

carlory commented May 14, 2024

/sig storage

@k8s-ci-robot k8s-ci-robot added sig/storage Categorizes an issue or PR as relevant to SIG Storage. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels May 14, 2024
@xing-yang
Copy link
Contributor

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/storage Categorizes an issue or PR as relevant to SIG Storage. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

4 participants