Mounting NFS Persistent Volumes with authentication

Viewed 2196

I'm trying to mount a Persistent Volume on a self hosted Kubernetes cluster using NFS (SMB to be precise). I created a share with a user and password on another machine (my samba host), I have tested that the share is accessible from the network. So the problem is that when accessing it I would need to provide the credentials. The following is how I mount the volume:

kind: PersistentVolume
metadata:
  name: nfs
spec:
  capacity:
    storage: 20Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  storageClassName: nfs
  mountOptions:
    - hard
    - nfsvers=4.1
  secret:
    secretName: nfs-secret
  nfs:
    path: /kubernetes
    server: 192.168.1.11
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nfs-claim 
spec:
  storageClassName: nfs
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 20Gi

And I have tried setting up a secret, but the problem is that secrets are for passing credentials inside a pod. Have been banging my head for weeks, can anyone help?

1 Answers

"NFS (SMB to be precise)"

Which is it? They are not the same thing. Your code example is showing nfs, but you said SMB.

Related