Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

139
Visualizações
deploy MongoDB in EKS/EFS with Mongo Operator

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])?)*') 
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I replicated this error and I found an error in your yaml file. There is a missing indentation in the voluemClaimTemplates name.

This is your yaml file:

     volumeClaimTemplates:
       - metadata:
    👉   name: data-volume
         spec:
          accessModes: [ "ReadWriteOnce" ]
          resources:
            requests:
              storage: 1Gi
            storageClassName: "efs-sc"

And this is the correct part with fixed indentation:

     volumeClaimTemplates:
       - metadata:
    👉     name: data-volume
         spec:
          accessModes: [ "ReadWriteOnce" ]
          resources:
            requests:
              storage: 1Gi
            storageClassName: "efs-sc"

It appears that because of this error the operator could not get the name correctly and he was trying to create volumes with its default template. You can verify that yourself with k get sts mongodb -oyaml:

  volumeClaimTemplates:
  - apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 1Gi
      volumeMode: Filesystem
  - apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: data-volume
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 10G
      volumeMode: Filesystem

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda