synology-csi icon indicating copy to clipboard operation
synology-csi copied to clipboard

Issue when using synology-csi

Open UmanGarbag opened this issue 3 years ago • 7 comments
trafficstars

Hello, i'm trying using the synology-csi driver for my kubernetes cluster and i ran with this problem.

My Nas DSM version is 7.0, but my k8s cluster version is v1.22.4.

This is my issue seen in the synology-csi-controller pod

(mers/factory.go:135 2022-01-16T22:09:13.211693168+01:00 csi-attacher E0116 21:09:13.211663       1 reflector.go:156] k8s.io/client-go/informers/factory.go:135: Failed to list *v1beta1.VolumeAttachment: the server could not find the requested resource)

Do you think it's because of the version of my cluster ?

Thanks

UmanGarbag avatar Jan 16 '22 21:01 UmanGarbag

I had the same issue and upgraded csi-attacher to use a different image: longhornio/csi-attacher:v3.2.1.

After that the error went away but got a new error:

Error saving VolumeAttachment csi-47df7406f0bc129bb07faf17247de5338907f89aa704a1e0db1bfe9b46b624b6 as attached: volumeattachments.storage.k8s.io "csi-47df7406f0bc129bb07faf17247de5338907f89aa704a1e0db1bfe9b46b624b6" is forbidden: User "system:serviceaccount:synology-csi:csi-controller-sa" cannot patch resource "volumeattachments/status" in API group "storage.k8s.io" at the cluster scope

I added the following rule to the synology-csi-controller-role clusterrole rules and everything started to work:

  - apiGroups: ["storage.k8s.io"]
    resources: ["volumeattachments/status"]
    verbs: ["patch"]

See my fork (mainly for adding ARM support) for more information: https://github.com/johanvandeweerd/synology-csi

johanvandeweerd avatar Jan 17 '22 10:01 johanvandeweerd

Thanks i will try this !

I keep you updated

UmanGarbag avatar Jan 17 '22 12:01 UmanGarbag

Ok it's seems to works , I no longer have the error from the beginning. But now the driver can't find location of my share in my nas synology.

image

In my NAS I have the /volume2/srv share with no specific permissions anyone in this subnet can access.

image

Do you have a deployment configuration to share ? I don't understand why he can't found this folder.

Thanks for help !

UmanGarbag avatar Jan 17 '22 22:01 UmanGarbag

Ok without specify the location it's works.

That weird

image

UmanGarbag avatar Jan 17 '22 22:01 UmanGarbag

Just in case, you can test it by applying following manifest:

---
apiVersion: v1
kind: Namespace
metadata:
  name: test
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nginx
  namespace: test
spec:
  accessModes:
  - ReadWriteMany
  storageClassName: synology-iscsi-storage 
  resources:
    requests:
      storage: 1Gi
---
apiVersion: v1
kind: Pod
metadata:
  labels:
    run: nginx
  name: nginx
  namespace: test
spec:
  initContainers:
  - image: nginx:alpine
    name: nginx-init
    command: ["sh", "-c", "echo '<h1>Hello world</h1>' > /usr/share/nginx/html/index.html"]
    volumeMounts:
    - name: html
      mountPath: /usr/share/nginx/html
  containers:
  - image: nginx:alpine
    name: nginx
    resources: {}
    volumeMounts:
    - name: html
      mountPath: /usr/share/nginx/html
  volumes:
  - name: html
    persistentVolumeClaim:
      claimName: nginx
---
apiVersion: v1
kind: Service
metadata:
  labels:
    run: nginx
  name: nginx
  namespace: test
spec:
  ports:
  - port: 80
    protocol: TCP
  selector:
    run: nginx

Afterwards do a port forward and you should be able to curl/surf to the pod.

kubectl port-forward -n test svc/nginx 8000:80
curl http://localhost:8000

johanvandeweerd avatar Jan 18 '22 13:01 johanvandeweerd

Ok thanks you Johan ! It Works !!

Is it possible to make a pull request with your changes in the repo https://github.com/democratic-csi/democratic-csi ?

UmanGarbag avatar Jan 18 '22 21:01 UmanGarbag

Not sure what you want me to put in a PR for the democratic-csi repo?

johanvandeweerd avatar Jan 22 '22 11:01 johanvandeweerd