I'm trying to deploy mongodb with the kubernetes operator on AWS EKS with EFS for the storage class. Just following the documentation examples here:
https://github.com/mongodb/mongodb-kubernetes-operator
I don't understand how to define the PVC naming properly. I've looked through the Github issues and Stack Overflow. Just not finding the example to resolve what seems to be a simple issue.
apiVersion: mongodb.com/v1
kind: MongoDB
metadata:
name: mongodb
spec:
members: 1
type: ReplicaSet
version: "4.2.6"
security:
authentication:
modes: ["SCRAM"]
users:
- name: my-user
db: admin
passwordSecretRef: # a reference to the secret that will be used to generate the user's password
name: my-user-password
roles:
- name: clusterAdmin
db: admin
- name: userAdminAnyDatabase
db: admin
scramCredentialsSecretName: my-scram
statefulSet:
spec:
volumeClaimTemplates:
- metadata:
name: data-volume
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
storageClassName: "efs-sc"
Events:
create Pod mongodb-0 in StatefulSet mongodb failed error: failed to create PVC -mongodb-0: PersistentVolumeClaim "-mongodb-0" is invalid: metadata.name: Invalid value: "-mongodb-0": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')