2

我正在尝试使用 RabbitMQ 集群 Kubernetes 运算符创建 RabbitMQ 实例,但 PersistentVolumeClaims 存在问题。我正在使用 Docker Desktop for Windows 运行 Kubernetes 1.18.8。

我已经安装了这样的操作员:

kubectl apply -f "https://github.com/rabbitmq/cluster-operator/releases/latest/download/cluster-operator.yml"

我根据文档为实例创建了这个非常简单的配置:

apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
  name: nccrabbitmqcluster

它似乎创建了它应该创建的所有对象,但是 pod 卡在挂起状态:

$ kubectl get all | grep rabbit
pod/nccrabbitmqcluster-server-0         0/1     Pending   0          14m
service/nccrabbitmqcluster                  ClusterIP      10.100.186.115   <none>        5672/TCP,15672/TCP   14m
service/nccrabbitmqcluster-nodes            ClusterIP      None             <none>        4369/TCP,25672/TCP   14m
statefulset.apps/nccrabbitmqcluster-server     0/1     14m

根据 pod 的事件,似乎有一个未绑定的 PVC:

$ kubectl describe pod/nccrabbitmqcluster-server-0 | tail -n 5
Events:
  Type     Reason            Age        From               Message
  ----     ------            ----       ----               -------
  Warning  FailedScheduling  <unknown>  default-scheduler  running "VolumeBinding" filter plugin for pod "nccrabbitmqcluster-server-0": pod has unbound immediate PersistentVolumeClaims
  Warning  FailedScheduling  <unknown>  default-scheduler  running "VolumeBinding" filter plugin for pod "nccrabbitmqcluster-server-0": pod has unbound immediate PersistentVolumeClaims

根据 PVC 的事件,它正在等待创建卷:

$ kubectl describe pvc persistence-nccrabbitmqcluster-server-0
Name:          persistence-nccrabbitmqcluster-server-0
Namespace:     default
StorageClass:  hostpath
Status:        Pending
Volume:
Labels:        app.kubernetes.io/component=rabbitmq
               app.kubernetes.io/name=nccrabbitmqcluster
               app.kubernetes.io/part-of=rabbitmq
Annotations:   volume.beta.kubernetes.io/storage-provisioner: docker.io/hostpath
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode:    Filesystem
Mounted By:    nccrabbitmqcluster-server-0
Events:
  Type    Reason                Age                 From                         Message
  ----    ------                ----                ----                         -------
  Normal  ExternalProvisioning  27s (x23 over 19m)  persistentvolume-controller  waiting for a volume to be created, either by external provisioner "docker.io/hostpath" or manually created by system administrator

我的理解是 docker.io/hostpath 是正确的供应商:

$ kubectl get storageclasses
NAME                 PROVISIONER          RECLAIMPOLICY   VOLUMEBINDINGMODE   ALLOWVOLUMEEXPANSION   AGE
hostpath (default)   docker.io/hostpath   Delete          Immediate           false                  20d

我看不到任何与 PCS 相关的 PV:

$ kubectl get pv | grep rabbit

为什么没有自动创建卷,我该怎么办?

4

1 回答 1

1

是的,您的本地主机路径不能用作动态卷配置器。这个操作符需要一个可以动态创建 PV 的 storageclassname。在您的情况下,您的操作员不断等待创建 PV。相反,如果您在本地机器上进行操作,您可以手动创建 PV 和 PVC。检查这个例子 - https://github.com/rabbitmq/cluster-operator/blob/main/docs/examples/multiple-disks/rabbitmq.yaml

如果您打算尝试任何像 AWS 这样的云提供商,那么它非常容易。在您的集群中部署 EBS CSI 驱动程序,这将为您创建一个存储类,并且该存储类将提供动态卷。

于 2021-03-17T06:17:46.960 回答