cifs icon indicating copy to clipboard operation
cifs copied to clipboard

Cifs plugin doesn't work if i use it in deployment

Open Gizmos777 opened this issue 4 years ago • 3 comments

Hello. I use cifs plugin and it work if i use as pod. I have decided as deployment, but it doesn't work

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  namespace: services
  labels:
    app: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.7.9
        ports:
        - containerPort: 80
        imagePullPolicy: IfNotPresent
        volumeMounts:
        - name: cifs-share
          mountPath: /data
        resources:
          limits:
            cpu: 300m
            memory: 128Mi
          requests:
            cpu: "200m"
            memory: 128Mi
      volumes:
      - name: cifs-share
        flexVolume:
          driver: fstab/cifs
          fsType: cifs
          options:
            mountOptions: dir_mode=0755,file_mode=0644,noperm
            networkPath: //server/data
          secretRef:
            name: cifs-secret

Status pod:

nginx-deployment-5864c58f6f-rbssq 0/1 ContainerCreating 0 8m4s

Describe pod: Unable to mount volumes for pod "nginx-deployment-5864c58f6f-rbssq_ccqc-services(074e8f98-b98d-408c-9070-46864d460cf7)": timeout expired waiting for volumes to attach or mount for pod "ccqc-services"/"nginx-deployment-5864c58f6f-rbssq". list of unmounted volumes=[cifs-share]. list of unattached volumes=[cifs-share default-token-24bkz]

Gizmos777 avatar Feb 25 '20 15:02 Gizmos777

While mostly a workaround, could you try using volume claims? https://stackoverflow.com/questions/46906068/is-there-any-way-to-have-a-flex-volume-inside-a-persistent-volume-claim

aptdamia avatar Feb 28 '20 06:02 aptdamia

To add to this, I have been using this module from PV/PVC within a deployment, unfortunately it only works as ReadOnly when deployed this way. If I attempt to mount it as ReadWrite the pods will fail to launch.

CaptainMcCurry avatar Mar 02 '20 15:03 CaptainMcCurry

For me this is working within a deployment. Here is my YAML, so you can compare:

apiVersion: apps/v1beta2
kind: Deployment
metadata:
  labels:
    app: elasticdump
  name: elasticdump
spec:
  replicas: 1
  selector:
    matchLabels:
      app: elasticdump
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      annotations:
        co.elastic.logs/enabled: "true"
      labels:
        app: elasticdump
    spec:
      containers:
      - name: elasticdump
        image: 10.173.8.16:5000/taskrabbit/elasticsearch-dump:v6.28.0
        args:
        - elasticdump
        - --input=http://elastic/test_index
        - --output=/mnt/test_index.json
        - --type=data
        imagePullPolicy: IfNotPresent
        volumeMounts:
        - name: backup
          mountPath: /mnt
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      volumes:
      - name: backup
        flexVolume:
          driver: "fstab/cifs"
          fsType: "cifs"
          secretRef:
            name: "cifs-secret"
          options:
            networkPath: "\\\\t1ref-hv1\\Share_ES"
            mountOptions: "dir_mode=0755,file_mode=0644,noperm"

kfehrenbach avatar May 06 '20 05:05 kfehrenbach