本文介绍了在使用ChelDB的Helm图表将CouchDB部署到K8S时,如何定义持久卷?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力将正确的步骤摆在正确的步骤上,以将[CouchDB](https://couchdb.apache.org]部署到Kubernetes集群中.

I'm trying to wrap my head around the correct steps to deploy [CouchDB](https://couchdb.apache.org] into a Kubernetes cluster.

我所做的是:

kubectl create secret --namespace mynamespace generic couch-test-couchdb \
  --from-literal=adminUsername=admin
  --from-literal=adminPassword=password
  --from-literal=cookieAuthSecret=supersecret

helm install --namespace mynamespace couch-test \
   --set couchdbConfig.couchdb.uuid=$(uuid | tr -d -) \
   -f couch-test.yml \
   couchdb/couchdb

使用 couch-test.yml :

createAdminSecret : false
persistentVolume.enabled : true
persistentVolume.size: 10Gi

该命令运行时没有错误消息,但是没有持久存储分配发生.当我键入 kubectl描述pod pod-test-couchdb-0 时,我进入了配置存储,数据库存储 EmptyDir

The command runs without an error message, however no persistent storage allocation happens. When I type kubectl describe pod couch-test-couchdb-0 I get in Volumes for config-storage, database-storage EmptyDir

我想念什么?

我怀疑我首先需要创建一个 PV ,但是尚不清楚如何将其链接到安装.是storageClass还是名称或其他名称?

I suspect I need to create a PV first, but it's not clear how to link it to the install. Is it the storageClass or the name or something else?

**更新**

我从头开始,删除了设置,并使用 k apply --namespace mynamespace -f couch-storage.yml

I started over, deleting the setup and add a storage class definition using k apply --namespace mynamespace -f couch-storage.yml

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: couch-storage
provisioner: kubernetes.io/no-provisioner
reclaimPolicy: Retain
allowVolumeExpansion: true
volumeBindingMode: WaitForFirstConsumer

所以 couch-farm.yml 现在看起来像这样:

So the couch-farm.yml now looks like this:

createAdminSecret : false
persistentVolume.enabled : true
persistentVolume.size: 10Gi
persistentVolume.storageClass : couch-storage

没什么区别,以 k描述pod ... 的存储仍然指向EmptyDir

No difference, storage in k describe pod... still points to EmptyDir

推荐答案

存储类是特定于环境/基础结构的,这就是为什么CouchDB Helm图表停止创建任何存储类的原因.

Storage classes are environment/infrastructure specific which is why the CouchDB Helm chart stops short of creating any.

图表应使用图表值文件中指定的存储类为每个吊舱创建一个 PersistantVolumeClaim .大多数生产Kubernetes生产环境将具有支持动态预配置的预配置 StorageClass 资源(或您可以在自己的StorageClass资源中引用的预配置器)列表,这些资源支持动态预配置,即在声明中指定存储类足以使后端运行关闭并分配适当的存储,并将其提供给Kubernetes.

The chart should create a PersistantVolumeClaim for each pod using the storage class specified in the chart values file. Most production Kubernetes environments will have a list of preconfigured StorageClass resources (or provisioners that you can reference in your own StorageClass resources) that support dynamic provisioning i.e. specifying the storageclass in the claim is enough for the backend to go off and allocate the appropriate storage and make it available to Kubernetes.

在您的情况下,您似乎正在定义用于存储的本地持久卷,这很好,但是比使用动态预配器还要复杂-您需要按照文档配置它并生成持久卷.

In your case it looks like you're defining a Local Persistant Volume for storage, which is perfectly fine but will be more complicated than using a dynamic provisioner - you'll need to go through the steps in the documentation to configure it and generate the persistant volumes.

如果您的环境支持它,请使用动态配置程序,例如此处可能更容易上手.

If your environment supports it, using a dynamic provisioner such as those listed here will likely be simpler to get started with.

这篇关于在使用ChelDB的Helm图表将CouchDB部署到K8S时,如何定义持久卷?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 20:21