0

i'm trying to mount a persistent volume into my windows container, but i alwys get this error:

Unable to mount volumes for pod "mssql-with-pv-deployment-3263067711-xw3mx_default(....)": timeout expired waiting for volumes to attach/mount for pod "default"/"mssql-with-pv-deployment-3263067711-xw3mx". list of unattached/unmounted volumes=[blobdisk01]

i've created a github gist with the console output of "get events" and "describe sc | pvc | po" maybe someone will find the solution with it.

Below are my scripts that I'm using for deployment.

my storageclass:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: azure-disk-sc
provisioner: kubernetes.io/azure-disk
parameters:
  skuname: Standard_LRS

my PersistentVolumeClaim:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: azure-disk-pvc
spec:
  storageClassName: azure-disk-sc
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi

and the deployment of my container:

apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: mssql-with-pv-deployment
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: mssql-with-pv
    spec:
      nodeSelector:
        beta.kubernetes.io/os: windows
      terminationGracePeriodSeconds: 10
      containers:
      - name: mssql-with-pv
        image: testacr.azurecr.io/sql/mssql-server-windows-developer
        ports:
        - containerPort: 1433
        env:
        - name: ACCEPT_EULA
          value: "Y"
        - name: SA_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mssql
              key: SA_PASSWORD
        volumeMounts:
        - mountPath: "c:/volume"
          name: blobdisk01
      volumes:
      - name: blobdisk01
        persistentVolumeClaim:
          claimName: azure-disk-pvc
---
apiVersion: v1
kind: Service
metadata:
  name: mssql-with-pv-deployment
spec:
  selector:
    app: mssql-with-pv
  ports:
    - protocol: TCP
      port: 1433
      targetPort: 1433
  type: LoadBalancer

what am i doing wrong? is there another way to mount a volume?

thank for every help :)

Lukas Möller
  • 135
  • 2
  • 12
  • What if you use the storageClassName attribute, instead of the volume.beta.kubernetes.io/storage-class annotation in the PVC definition? – André B Jun 07 '18 at 14:10
  • @AndréB i changed `metadata.annotations.volume.alpha.kubernetes.io/storage-class: azure-slow` to `spec.storageClassName: slow` but i'm still getting the same error – Lukas Möller Jun 08 '18 at 06:43
  • You mean spec.storageClassName: azure-slow right? – André B Jun 08 '18 at 09:19
  • 1
    @AndréB oh no, but i tried it now, the bound error for the pcv is gone but its still unable to mount the volume and stucks in container creation – Lukas Möller Jun 08 '18 at 09:44
  • You should update the post with the new development, maybe someone will be able to figure out the problem! :) – André B Jun 08 '18 at 10:07

2 Answers2

1

You will need a new volume in D: drive, looks like folders in C: are not supported for Windows Containers, see here:

https://github.com/kubernetes/kubernetes/issues/65060

Demos: https://github.com/andyzhangx/demo/tree/master/windows/azuredisk

glm
  • 2,131
  • 2
  • 13
  • 10
0

I would try:

  1. Change API version to v1: https://kubernetes.io/docs/concepts/storage/storage-classes/#azure-disk
  2. kubectl get events to see you if have a more detailed error (I could figure out the reason when I used NFS watching events)
  3. maybe is this bug, I read in this post?
Nicola Ben
  • 10,615
  • 8
  • 41
  • 65
  • I tried it but unfortunately there was no change to my problem. i've created a [github gist](https://gist.github.com/lftkv/f716d453b8c1a043fac7e8a52b8d6451) with the console output of "get events" and "describe sc | pvc | po" maybe someone will find the solution with it. I also couldn't find a connection between the bug and my problem. – Lukas Möller Jun 11 '18 at 10:12