Persistent volume to windows not working on kubernetes

12/17/2019

I have map windows folder into me linux machine with

mount -t cifs //AUTOCHECK/OneStopShopWebAPI -o user=someuser,password=Aa1234 /xml_shared 

and the following command

df -hk

give me

//AUTOCHECK/OneStopShopWebAPI   83372028   58363852   25008176  71% /xml_shared

after that I create yaml file with

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-nfs-jenkins-slave
spec:
  storageClassName: jenkins-slave-data
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 4Gi
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-nfs-jenkins-slave
  labels:
    type: jenkins-slave-data2
spec:
  storageClassName: jenkins-slave-data
  capacity:
    storage: 4Gi
  accessModes:
    - ReadWriteMany
  nfs:
    server: 192.168.100.109
    path: "//AUTOCHECK/OneStopShopWebAPI/jenkins_slave_shared"

this seems to not work when I create new pod

apiVersion: v1
kind: Pod
metadata:
  name: jenkins-slave
  labels:
    label: jenkins-slave
spec:
  containers:
  - name: node
    image: node
    command:
    - cat
    tty: true
    volumeMounts:
        - mountPath: /var/jenkins_slave_shared
          name: jenkins-slave-vol
  volumes:
    - name: jenkins-slave-vol
      persistentVolumeClaim:
        claimName: pvc-nfs-jenkins-slave

do i need to change the nfs ? what is wrong with me logic?

-- shaharnakash
kubernetes
volume
yaml

1 Answer

12/19/2019

The mounting of CIFS share under Linux machine is correct but you need to take different approach to mount CIFS volume under Kubernetes. Let me explain:

There are some differences between NFS and CIFS.

This site explained the whole process step by step: Github CIFS Kubernetes.

-- Dawid Kruk
Source: StackOverflow