Helm postgres 无法创建目录

问题描述 投票:0回答:1

我正在使用 Helm 在 Kubernetes 集群上部署 postgres。我创建了一个持久卷和一个持久卷声明:

pv.yaml:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: task-pv-volume
  labels:
    type: local
spec:
  storageClassName: manual
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteMany
  hostPath:
    path: "/mnt/data"

pvc.yaml:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: task-pv-claim
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 8Gi

并使用命令运行 helm:

helm install my-release stable/postgresql --set persistence.existingClaim=task-pv-claim

但是 Pods 处于 CrashLoopBackOff 状态。 Pod 的日志显示:

postgresql 12:12:18.62 
postgresql 12:12:18.62 Welcome to the Bitnami postgresql container
postgresql 12:12:18.62 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
postgresql 12:12:18.62 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
postgresql 12:12:18.63 Send us your feedback at [email protected]
postgresql 12:12:18.63 
postgresql 12:12:18.65 INFO  ==> ** Starting PostgreSQL setup **
postgresql 12:12:18.73 INFO  ==> Validating settings in POSTGRESQL_* env vars..
postgresql 12:12:18.73 INFO  ==> Loading custom pre-init scripts...
postgresql 12:12:18.74 INFO  ==> Initializing PostgreSQL database...
mkdir: cannot create directory ‘/bitnami/postgresql/data’: Permission denied
postgresql 12:12:18.76 INFO  ==> Stopping PostgreSQL...

我该如何修复它?

postgresql kubernetes kubernetes-helm
1个回答
22
投票

尝试将舵图

volumePermissions.enabled
设置为 true。

有时,集群设置默认情况下不会为正在运行的容器提供足够的权限来实际写入已安装的卷。

© www.soinside.com 2019 - 2024. All rights reserved.