首页 > 解决方案 > Kubernetes 中 OrientDB 的 StatefulSet 卷挂载

问题描述

我正在尝试使用 Kubernetes(特别是 minikube)部署一个 OreintDB 集群。我正在使用 StatefulSet,但是,当我在所有 OrientDB 集群配置的 volumeMounts 声明中使用子路径时,不会创建 Pod。虽然我想将所有 configMaps 挂载到一个文件夹中。ConfigMap 对应于设置 OrientDB 集群所需的多个配置文件。

StatefulSet 看起来像这样:

volumeMounts:
    - name: orientdb-config-backups
      mountPath: /orientdb/config
      subPath: backups
    - name: orientdb-config-events
      mountPath: /orientdb/config
      subPath: events
    - name: orientdb-config-distributed
      mountPath: /orientdb/config
      subPath: distributed
    - name: orientdb-config-hazelcast
      mountPath: /orientdb/config
      subPath: hazelcast
    - name: orientdb-config-server
      mountPath: /orientdb/config
      subPath: server
    - name: orientdb-config-client-logs
      mountPath: /orientdb/config
      subPath: client-logs
    - name: orientdb-config-server-logs
      mountPath: /orientdb/config
      subPath: server-log
    - name: orientdb-databases
      mountPath: /orientdb/databases
    - name: orientdb-backup
      mountPath: /orientdb/backup

虽然,当我删除 StatefulSet 中的所有子路径时,会创建 pod 并将配置文件放入单独的文件夹中。所以 StatefulSet 看起来像这样:

volumeMounts:
- name: orientdb-config-backups
  mountPath: /orientdb/config/backups
- name: orientdb-config-events
  mountPath: /orientdb/config/events
- name: orientdb-config-distributed
  mountPath: /orientdb/config/distributed
- name: orientdb-config-hazelcast
  mountPath: /orientdb/config/hazelcast
- name: orientdb-config-server
  mountPath: /orientdb/config/server
- name: orientdb-config-client-logs
  mountPath: /orientdb/config/client-logs
- name: orientdb-config-server-logs
  mountPath: /orientdb/config/server-logs
- name: orientdb-databases
  mountPath: /orientdb/databases
- name: orientdb-backup
  mountPath: /orientdb/backup
- name: orientdb-data
  mountPath: /orientdb/bin/data

这种行为的原因可能是什么?

标签: kubernetesorientdbminikube

解决方案


问题是主机路径卷配置程序中存在错误,如果部署/状态集中存在子路径字段,即使该字段为空,也会遇到“lstat:没有此类文件或目录”错误。此错误不会让 statefulset 出现,它们会进入 containerCreatingConfigErr(在 kubeadm 上发生在我身上)

这个问题在我遇到的 kubeadm 上也存在。

https://github.com/kubernetes/minikube/issues/2256


推荐阅读