数据目录是由PostgreSQL版本12初始化的,与13.10版本不兼容



我正在尝试在Kubernetes集群中运行postgres:13-alpine

我有下一个Kubernetes清单

光伏

kind: PersistentVolume
apiVersion: v1
metadata:
name: open-imis-pv-volume
labels:
type: local
app: postgres
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteMany
hostPath:
path: /mnt/data
PVC

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: open-imis-pv-claim
namespace: open-imis
labels:
app: postgres
spec:
storageClassName: manual
accessModes:
- ReadWriteMany
resources:
requests:
storage: 5Gi

部署
apiVersion: apps/v1
kind: Deployment
metadata:
name: open-imis-db
namespace: open-imis
labels:
app: open-imis-db
spec:
selector:
matchLabels:
app: open-imis-db
strategy:
type: Recreate
template:
metadata:
labels:
app: open-imis-db
spec:
containers:
- image: postgres:13-alpine
name: open-imis-db
env:
- name: open-imis-secret
valueFrom:
secretKeyRef:
name: open-imis-secret
key: password
ports:
- containerPort: 5432
name: postgres
volumeMounts:
- name: postgres
mountPath: /var/lib/postgresql/data
volumes:
- name: postgres
persistentVolumeClaim:
claimName: open-imis-pv-claim

更多细节见Pull Request

你能帮我找出下一个错误的podCrashLoopBackOff的原因吗:

PostgreSQL Database directory appears to contain a database; Skipping initialization
2023-04-04 16:38:05.912 UTC [1] FATAL:  database files are incompatible with server
2023-04-04 16:38:05.912 UTC [1] DETAIL:  The data directory was initialized by PostgreSQL version 12, which is not compatible with this version 13.10.

我没有在任何地方明确设置PostgreSQL版本12。它从何而来?

问题与挂载路径有关对于13版本,我必须使用

mountPath: /var/lib/pgsql/datanot

mountPath: /var/lib/postgresql/data

相关内容

  • 没有找到相关文章

最新更新