[英]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.