k8s unable to mount vsphere vsan disk to pod

4/12/2018

i have a problem with persistent volumes and vmware vsan

i'm using kubernetes v1.9.5 on CentOS 7 deployed with kubespray (cloudprovider: vsphere). the pods are not able to mount to vsan devices:

Events:
  Type     Reason                 Age   From                       Message
  ----     ------                 ----  ----                       -------
  Normal   Scheduled              2m    default-scheduler          Successfully assigned pvpod to k8s-worker-5
  Normal   SuccessfulMountVolume  2m    kubelet, k8s-worker-5  MountVolume.SetUp succeeded for volume "default-token-c5mqh"
  Warning  FailedMount            56s   kubelet, k8s-worker-5  Unable to mount volumes for pod "pvpod_default(62b1704e-3e27-11e8-9cfc-0050568f0ce4)": timeout expired waiting for volumes to attach/mount for pod "default"/"pvpod". list of unattached/unmounted volumes=[test-volume]

the volume is assigned to the kubernetes worker-5 (sdb)

[root@k8s-worker-5 ~]# fdisk -l

Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000ac2d7

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200     3147775      524288   82  Linux swap / Solaris
/dev/sda3         3147776   209712509   103282367   83  Linux

Disk /dev/sdb: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

pv and pvc are created:

[root@k8s-jump ]# kubectl get pv
NAME                                       CAPACITY   ACCESS MODES   RECLAIM     POLICY   STATUS    CLAIM              STORAGECLASS   REASON    AGE
pvc-60b0f1d9-3e27-11e8-9cfc-0050568f0ce4   2Gi        RWO            Delete               Bound     default/pvcsc001   vsan                     5m

[root@k8s-jump ]# kubectl get pvc
NAME       STATUS    VOLUME                                     CAPACITY       ACCESS MODES   STORAGECLASS   AGE
pvcsc001   Bound     pvc-60b0f1d9-3e27-11e8-9cfc-0050568f0ce4   2Gi            RWO            vsan           5m

this is my test deployment manifest

---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: vsan
provisioner: kubernetes.io/vsphere-volume
parameters:
  datastore: vsanDatastore
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pvcsc001
      annotations:
    volume.beta.kubernetes.io/storage-class: vsan
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 2Gi
---
apiVersion: v1
kind: Pod
metadata:
  name: pvpod
spec:
  containers:
  - name: test-container
    image: k8s.gcr.io/test-webserver
    volumeMounts:
    - name: test-volume
      mountPath: /test-vmdk
  volumes:
  - name: test-volume
    persistentVolumeClaim:
      claimName: pvcsc001
-- schlussbilanz
kubernetes
storage
vmware
vsphere

1 Answer

4/12/2018
-- schlussbilanz
Source: StackOverflow