简体   繁体   English

无法在本地存储 class 上设置具有持久卷的 couchbase operator 1.2

[英]Unable to setup couchbase operator 1.2 with persistent volume on local storage class

I am trying to setup couchbase operator 1.2 on my local system.我正在尝试在我的本地系统上设置 couchbase operator 1.2。 i followed the following steps:我按照以下步骤操作:

But the problem with this is that as soon as the system or docker resets or the pod resets, the cluster's data is lost.但是这样做的问题是,一旦系统或 docker 重置或 pod 重置,集群的数据就会丢失。

So for the same I tried to do it by adding persistent volume with local storage class as mentioned in the docs but the result was still the same.因此,我尝试通过在文档中提到的使用本地存储 class 添加持久卷来做到这一点,但结果仍然相同。 The pod still gets resets.吊舱仍会重置。 and i am unable to find the reason for the same.我找不到同样的原因。

So if anyone can advise on how to do the same with persistent volume on local storage class.因此,如果有人可以建议如何对本地存储 class 上的持久卷执行相同的操作。 I have successfully created a storage class.我已经成功创建了一个存储 class。 Just having problem while getting the cluster up and keep the consistency for the same.只是在启动集群并保持一致性时遇到问题。

Here is the yamls that i used to create the storage class and pv and pv claim这是我用来创建存储 class 和 pv 和 pv 声明的 yaml

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
 name: myssd
provisioner: local
apiVersion: v1
kind: PersistentVolume
metadata:
 name: couchbase-data-2
 labels:
    type: local
spec:
 capacity:
  storage: 10Gi
 accessModes:
  - ReadWriteOnce
 storageClassName: myssd
 hostPath:
    path: "/home/<user>/cb-storage/"
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-test-claim-2
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: myssd
  resources:
    requests:
      storage: 1Gi

Thanks in advance提前致谢

Persistent volume using hostPath is not durable.使用hostPath的持久卷不是持久的。 Use a local volume.使用local卷。 Compared to hostPath volumes, local volumes can be used in a durable and portable manner without manually scheduling Pods to nodes, as the system is aware of the volume's node constraints by looking at the node affinity on the PersistentVolume .hostPath卷相比, local卷可以以持久且可移植的方式使用,而无需手动将 Pod 调度到节点,因为系统通过查看PersistentVolume上的节点亲和性来了解卷的节点约束。

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer

---

apiVersion: v1
kind: PersistentVolume
metadata:
  name: couchbase-data
spec:
  capacity:
    storage: 10Gi
  accessModes:
  - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: local-storage
  local:
    path: /home/<User>/cb-storage/
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - node1
          - node2
          - node3
          - node4

You don't need to create a PersistentVolume manually because the storage class will do that internally.您不需要手动创建 PersistentVolume,因为存储 class 将在内部执行此操作。

Also you need to configure the local volume provisioner as discussed here so that dynamic provisioning using the local storage class happens.此外,您还需要按照此处所述配置local卷配置程序,以便使用本地存储 class 进行动态配置。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用 Kubernetes 中的默认存储 class 在 AWS 上创建持久卷 - Unable to create persistent volume on AWS using the default storage class in Kubernetes 使用 Kubernetes 在物理机上设置本地持久卷 - Setup Local Persistent Volume on physical machines with Kubernetes 存储类无法使用 blob-csi-driver 创建持久卷 - Storage Class unable to create persistent volume using blob-csi-driver Kubernetes:minikube 持久卷本地文件系统存储位置 - Kubernetes: minikube persistent volume local filesystem storage location 如何找到正确的 devicePaths 以用于 Openshift 持久卷的本地存储? - How to find the correct devicePaths to use in local storage for an Openshift Persistent Volume? 更新 K8 存储 class、持久卷和更新 K8 机密时的持久卷声明 - Update K8 storage class, persistent volume, and persistent volume claim when K8 secret is updated 存储 class 是否为每个 pod 动态配置持久卷? - Does the storage class dynamically provision persistent volume per pod? Docker Desktop for Windows - 无法在本地硬盘驱动器上创建持久卷 - Docker Desktop for Windows - Unable to create a persistent volume on local hard drive 无法在EBS上设置Promethues监控的Kubernetes指标持久存储 - Unable to setup Promethues monitored Kubernetes metrics persistent storage on EBS 无法在带有舵手的kubernetes上设置具有持久性存储的Docker私有注册表 - Unable to setup docker private registry with persistent storage on kubernetes with helm
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM