У меня ниже StatefulSet postgres для EKS.Когда я запускаю его, я получаю сообщение об ошибке ниже.
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedCreate 7s (x17 over 1m) statefulset-controller create Pod postgres-0 in StatefulSet postgres failed error: Pod "postgres-0" is invalid: spec.containers[0].volumeMounts[0].name: Not found: "postgredb"
StatefulSet:
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: postgres
spec:
selector:
matchLabels:
app: postgres # has to match .spec.template.metadata.labels
serviceName: "postgres"
replicas: 1
template:
metadata:
labels:
app: postgres
spec:
terminationGracePeriodSeconds: 10
containers:
- name: postgres
image: postgres:10.4
imagePullPolicy: "IfNotPresent"
ports:
- containerPort: 5432
volumeMounts:
- name: postgredb
mountPath: /var/lib/postgresql/data
volumeClaimTemplates:
- metadata:
name: postgresdb
annotations:
volume.beta.kubernetes.io/storage-class: "aws-efs"
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
У меня также настроен StorageClass.Что я тут не так делаю?