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

Unable to attach or mount volumes:

Open leyi-bc opened this issue 3 years ago • 2 comments

hi,can you help me solve this problem? Unable to attach or mount volumes: unmounted volumes=[webroot], unattached volumes=[istio-token istio-podinfo kube-api-access-g9wh7 webroot istiod-ca-cert istio-data istio-envoy]: timed out waiting for the condition

I think there is no problem with my PVC

Name: csi-s3-existing-bucket Namespace: default StorageClass: csi-s3-existing-bucket Status: Bound Volume: pvc-68bdbede-e355-48ce-9ce7-7d47a9219da8 Labels: Annotations: pv.kubernetes.io/bind-completed: yes pv.kubernetes.io/bound-by-controller: yes volume.beta.kubernetes.io/storage-provisioner: ch.ctrox.csi.s3-driver Finalizers: [kubernetes.io/pvc-protection] Capacity: 1Gi Access Modes: RWO VolumeMode: Filesystem Used By: csi-s3-test-nginx Events:

`apiVersion: v1 kind: Pod metadata: name: csi-s3-test-nginx namespace: default spec: containers:

  • name: csi-s3-test-nginx image: nginx volumeMounts:
    • mountPath: /var/lib/www/html name: webroot volumes:
  • name: webroot persistentVolumeClaim: claimName: csi-s3-existing-bucket readOnly: false `

leyi-bc avatar Jul 15 '22 07:07 leyi-bc

image image

leyi-bc avatar Jul 15 '22 07:07 leyi-bc

I had the same problem, I looked at the logs of the csi-attacher-s3 pod, first i saw Failed to list *v1beta1.VolumeAttachment: the server could not find the requested resource. I figured it was a k8s version issue, so I updated the container image of the csi-attacher stateful set, from v2.2.1 to canary (the latest).

kubectl -n kube-system set image statefulset/csi-attacher-s3 csi-attacher=quay.io/k8scsi/csi-attacher:canary

Next I got a permission error: `v1.VolumeAttachment: failed to list *v1.VolumeAttachment: volumeattachments.storage.k8s.io is forbidden: User "system:serviceaccount:kube-system:csi-attacher-sa" cannot list resource "volumeattachments" in API group "storage.k8s.io" at the cluster scope.

I tried to modify the role bindings but I couldn't find the right combinations so I ended up giving the csi-attacher-sa service account cluster-admin privileges as shown below:

kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: csi-attacher-all
subjects:
  - kind: ServiceAccount
    name: csi-attacher-sa
    namespace: kube-system
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin

fallmo avatar Sep 16 '22 09:09 fallmo