您如何使用 microk8s 为 openebs 安装 mayastor 以用作 PV/SC?

问题描述

我有一个在 virtualBox Ubuntu vms 上运行的 3 节点 microk8s 集群。我正在尝试让 Mayastor for openebs 与 PVC 一起使用。我已按照本指南中的步骤操作:

  1. https://mayastor.gitbook.io/introduction/quickstart/preparing-the-cluster
  2. https://mayastor.gitbook.io/introduction/quickstart/deploy-mayastor
  3. https://mayastor.gitbook.io/introduction/quickstart/configure-mayastor

第 3 步中的 MayastorPool 示例如下所示:

apiVersion: "openebs.io/v1alpha1"
kind: MayastorPool
Metadata:
  name: pool-on-node1-n2
  namespace: mayastor
spec:
  node: node1
  disks: [ "/dev/nvme0n2" ]

我的 StorageClass 看起来像这样:

apiVersion: storage.k8s.io/v1
kind: StorageClass
Metadata:
  name: mayastor-3
provisioner: io.openebs.csi-mayastor
parameters:
  repl: '3'
  protocol: 'nvmf'
  ioTimeout: '60'
  local: 'true'
volumeBindingMode: WaitForFirstConsumer

根据指南,所有检查看起来都很好,但是当我尝试创建 PVC 并根据此 https://mayastor.gitbook.io/introduction/quickstart/deploy-a-test-application 使用它时,测试应用程序 fio pod 没有出现。当我用 describe 查看它时,我看到以下内容$ kubectl describe pods fio -n mayastor

Name:         fio
Namespace:    mayastor
Priority:     0
Node:         node2/192.168.40.12
Start Time:   Wed,02 Jun 2021 22:56:03 +0000
Labels:       <none>
Annotations:  <none>
Status:       Pending
IP:           
IPs:          <none>
Containers:
  fio:
    Container ID:  
    Image:         nixery.dev/shell/fio
    Image ID:      
    Port:          <none>
    Host Port:     <none>
    Args:
      sleep
      1000000
    State:          Waiting
      Reason:       ContainerCreating
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-l6cdf (ro)
      /volume from ms-volume (rw)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  ms-volume:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  ms-volume-claim
    ReadOnly:   false
  kube-api-access-l6cdf:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              openebs.io/engine=mayastor
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason                  Age                  From                     Message
  ----     ------                  ----                 ----                     -------
  normal   Scheduled               44m                  default-scheduler        Successfully assigned mayastor/fio to node2
  normal   SuccessfulAttachVolume  44m                  attachdetach-controller  AttachVolume.Attach succeeded for volume "pvc-ec6ce101-fb3e-4a5a-8d61-1d228f8f8199"
  Warning  FailedMount             24m (x4 over 40m)    kubelet                  Unable to attach or mount volumes: unmounted volumes=[ms-volume],unattached volumes=[kube-api-access-l6cdf ms-volume]: timed out waiting for the condition
  Warning  FailedMount             13m (x23 over 44m)   kubelet                  MountVolume.SetUp Failed for volume "pvc-ec6ce101-fb3e-4a5a-8d61-1d228f8f8199" : rpc error: code = Internal desc = Failed to find parent dir for mountpoint /var/snap/microk8s/common/var/lib/kubelet/pods/b1166af6-1ade-4a3a-9b1d-653151418695/volumes/kubernetes.io~csi/pvc-ec6ce101-fb3e-4a5a-8d61-1d228f8f8199/mount,volume ec6ce101-fb3e-4a5a-8d61-1d228f8f8199
  Warning  FailedMount             4m3s (x13 over 42m)  kubelet                  Unable to attach or mount volumes: unmounted volumes=[ms-volume],unattached volumes=[ms-volume kube-api-access-l6cdf]: timed out waiting for the condition

有什么想法可以让 Mayastor 使用 microk8s 吗?很高兴发布更多信息。

解决方法

感谢 Kiran Mova 的评论和 openebs slack 频道的 Niladri:

替换步骤: https://mayastor.gitbook.io/introduction/quickstart/deploy-mayastor#csi-node-plugin

kubectl apply -f https://raw.githubusercontent.com/openebs/Mayastor/master/deploy/csi-daemonset.yaml

curl -fSs https://raw.githubusercontent.com/openebs/Mayastor/master/deploy/csi-daemonset.yaml | sed "s|/var/lib/kubelet|/var/snap/microk8s/common/var/lib/kubelet|g" - | kubectl apply -f -

所以用microk8s安装特定路径替换路径。即使有符号链接,如果没有此更改,事情似乎也无法解决。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...