我想用pvc创建postgres掌 Helm 聊天,请让我知道如何做,
在katacoda https://www.katacoda.com/courses/kubernetes/helm-package-manager中尝试
用pvc创建Postgres掌 Helm chart 。
最佳答案
正如我们可以从PostgreSQL Helm chart 文档中读取的那样,它可以与以下parameters一起使用:
+----------------------------+-----------------------------------------------------------------+---------------+
| Parameter | Description | Default |
+----------------------------+-----------------------------------------------------------------+---------------+
| persistence.enabled | Enable data persistence | true |
| persistence.existingClaim | Use a existing PVC which must be created manually before bound | nil |
| persistence.storageClass | Specify the storageClass used to provision the volume | nil |
| persistence.mountPath | Path to mount data volume at | nil |
| persistence.accessMode | Access mode of data volume | ReadWriteOnce |
| persistence.size | Size of data volume | 8Gi |
| persistence.annotations | Persistent Volume Claim annotations | {} |
+----------------------------+-----------------------------------------------------------------+---------------+
Persistence
The data is persisted by default using PVC templates in the PostgreSQL statefulset. You can disable the persistence setting the
persistence.enabled
parameter tofalse
. A defaultStorageClass
is needed in the Kubernetes cluster to dynamically provision the volumes. Specify another StorageClass in thepersistence.storageClass
or setpersistence.existingClaim
if you have already existing persistent volumes to use.
这意味着您只需要创建自己的Persistent Volume即可,例如:
pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: task-pv-volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"
pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: task-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 8Gi
一旦部署和限制了这些,就可以安装PostgreSQL图表:
helm install my-release bitnami/postgresql --set persistence.existingClaim=task-pv-claim
关于kubernetes - 如何使用pvc创建postgres Helm 图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63279838/