kubernetes-csi / csi-driver-smb

This driver allows Kubernetes to access SMB Server on both Linux and Windows nodes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MountVolume.MountDevice failed for volume "pv-cloud-volume-smb" : rpc error: code = Aborted desc = An operation with the given Volume ID vol1 already exists

pandithdurai opened this issue · comments

Hello,

I have installed SMB CSI driver in GKE for windows and getting the below error in the app deployment. The documentation I followed https://cloud.google.com/kubernetes-engine/docs/how-to/access-smb-volume

Events:
Type Reason Age From Message


Normal Scheduled 2m6s default-scheduler Successfully assigned default/abc-dev-7cf74448-crqkj to gke-da741e-4hxr
Warning FailedMount 6s kubelet MountVolume.MountDevice failed for volume "pv-cloud-volume-smb" : rpc error: code = DeadlineExceeded desc = context deadline exceeded
Warning FailedMount 3s kubelet Unable to attach or mount volumes: unmounted volumes=[smb], unattached volumes=[kube-api-access-xp98b smb]: timed out waiting for the condition
Warning FailedMount 2s (x3 over 5s) kubelet MountVolume.MountDevice failed for volume "pv-cloud-volume-smb" : rpc error: code = Aborted desc = An operation with the given Volume ID vol1 already exists

Please find the k8s manifest file for the reference

PersistentVolume

apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-cloud-volume-smb
spec:
capacity:
storage: 100Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
csi:
driver: smb.csi.k8s.io
readOnly: false
volumeHandle: vol1
volumeAttributes:
source: "//SMB_SERVER_NAME/SHARE_NAME"
nodeStageSecretRef:
name: cloud-volume-secret
namespace: default

PersistentVolumeClaim

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-cv-smb
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
volumeName: pv-cloud-volume-smb
storageClassName: ""

Deployment


apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: abc-dev
name: abc-dev
namespace: default
spec:
replicas: 2
selector:
matchLabels:
app: abc-dev
template:
metadata:
labels:
app: abc-dev
spec:
securityContext:
windowsOptions:
gmsaCredentialSpecName: gmsa-webhook
containers:
- image: {IMAGE}
imagePullPolicy: Always
name: tgs-esa-dev
ports:
- containerPort: 80
volumeMounts:
- name: smb
mountPath: "pv/pv-cv-smb"
volumes:
- name: smb
persistentVolumeClaim:
claimName: pvc-cv-smb
nodeSelector:
kubernetes.io/os: windows

rename your volumeHandle: vol1 to something unique, like a guid, like volumeHandle: c21a2ea8-4cd0-450d-9371-f8c9ca41cbd0

close issue since answer is provided.