【问题标题】:k8s unable to mount vsphere vsan disk to podk8s 无法将 vsphere vsan 磁盘挂载到 pod
【发布时间】:2018-04-12 08:23:35
【问题描述】:

我遇到了持久卷和 vmware vsan 的问题

我在 CentOS 7 上使用 kubernetes v1.9.5 部署了 kubespray(cloudprovider:vsphere)。 pod 无法挂载到 vSAN 设备:

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]

卷分配给 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 和 pvc 已创建:

[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

这是我的测试部署清单

---
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

【问题讨论】:

  • Linux k8s-worker-5 3.10.0-514.21.2.el7.x86_64 #1 SMP Tue Jun 20 12:24:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

标签: storage vmware vsphere kubernetes


【解决方案1】:
猜你喜欢
  • 2021-03-28
  • 1970-01-01
  • 2019-11-08
  • 1970-01-01
  • 2018-06-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-21
相关资源
最近更新 更多