PostgreSQL在Kubernetes上的卷权限错误 [英] postgres on kubernetes volume permission error
问题描述
我正在尝试在GKE上部署postgres / postgis,但是我继续收到权限错误: initdb:无法更改目录 / var / lib / postgresql / data的权限:操作不允许
。我尝试了各种研究过的修复程序,但尚未通过此错误。以下是我的部署Yaml。
I'm trying to deploy postgres/postgis on GKE, but I continue to get the permission error: initdb: could not change permissions of directory "/var/lib/postgresql/data": Operation not permitted
. I've tried various fixes that I've researched but I've yet to get passed this error. Below is my deployment yaml.
我丢失了什么?
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: postgres
spec:
replicas: 1
template:
metadata:
labels:
app: postgres
spec:
terminationGracePeriodSeconds: 10
securityContext:
runAsUser: 1000
fsGroup: 1000
containers:
- name: postgres
image: mdillon/postgis:10
imagePullPolicy: "IfNotPresent"
ports:
- containerPort: 5432
env:
- name: POSTGRES_DB
value: "database"
- name: POSTGRES_USER
value: "postgres"
- name: POSTGRES_PASSWORD
value: "postgres"
volumeMounts:
- name: postgredb
mountPath: /var/lib/postgresql/data
subPath: data
volumes:
- name: postgredb
persistentVolumeClaim:
claimName: postgres-pvc
推荐答案
虽然问题不完全相同,但这是使用 initContainer:
到 chmod
答案将使您感兴趣:小丑:更改'/ data / db'的所有权:不允许进行操作
While it is not exactly the same question, this "use an initContainer:
to chmod
" answer will interest you: chown: changing ownership of '/data/db': Operation not permitted
这篇关于PostgreSQL在Kubernetes上的卷权限错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!