Back to Hub

cargo.ayedo.cloud/ayedo/k8s/mongodb 0.3.2 k8sapp SSPL-1.0

Document database for Kubernetes via the MongoDB Community/Bitnami Helm chart

polycrate block pull cargo.ayedo.cloud/ayedo/k8s/mongodb:0.3.2

MongoDB

Instaliert MongoDB als Standalone oder Replica

Changelog

  • x.x.x Moved to CHANGELOG.poly
  • 0.0.3 chore: added block.kind stanza
  • 0.0.2 fix: Beispiel in Readme korrigiert.
  • 0.0.1 Initial Setup

actions

install

HA Setup mit Replicas + Arbiter (Voter only)

blocks:
  - name: mongodb
    from: cargo.ayedo.cloud/ayedo/k8s/mongodb
    kubeconfig:
      from: k8s
    config:
      mongodb:
        architecture: "replicaset"
        auth:
          enabled: true
          root_user: root_user_here
          root_password: root_password_here
          users:
            - "db_username"
          passwords:
            - "db_password"
          databases:
            - "db_name"
        replication:
          count: 3 # number of replicas
          key: replica_key_here # min 6 characters long / user for replica auth
        persistence:
          resourcePolicy: keep # keep volume after deletion
          size: 50Gi
        backup:
          enabled: true
          schedule: "@daily"
          ttlafterfinished: "86390" # (60 * 60 * 24) - 40 = 23h und 40m. 20min weniger als @daily. Ansonsten kann velero das Volume nicht sichern.
          storage_size: "50Gi"
        metrics:
          enabled: true

Mit TLS/mTLS (optional, für Teleport)

blocks:
  - name: mongodb
    from: cargo.ayedo.cloud/ayedo/k8s/mongodb
    kubeconfig:
      from: k8s
    config:
      mongodb:
        architecture: "replicaset"
        auth:
          enabled: true
          root_user: root_user_here
          root_password: root_password_here
          tls:
            enabled: true
            mode: preferTLS  # allowTLS | preferTLS | requireTLS
            auto_generate: true
            mtls:
              enabled: false  # true = Client-Cert REQUIRED, false = optional
              allow_connections_without_certificates: true  # Clients ohne Cert erlaubt
        # ... rest of config

TLS Modi: - allowTLS - TLS optional, Plaintext erlaubt - preferTLS - TLS bevorzugt, Plaintext erlaubt (empfohlen für gemischte Umgebungen) - requireTLS - TLS zwingend erforderlich

mTLS Konfiguration: - mtls.enabled: false + allow_connections_without_certificates: true = Clients KÖNNEN ein Zertifikat präsentieren (für X.509 Auth), müssen aber nicht - mtls.enabled: true = Alle Clients MÜSSEN ein gültiges Zertifikat präsentieren

export-ca

Exportiert die auto-generierten CA-Zertifikate für mTLS-Client-Konfiguration (z.B. Teleport).

polycrate run mongodb export-ca

Die Zertifikate werden unter artifacts/blocks/mongodb/tls/ gespeichert: - ca.crt - CA Zertifikat (an Clients weitergeben) - ca.key - CA Private Key (für Signierung von Client-Zertifikaten)

X.509 User in MongoDB anlegen (vom Endkunden):

use $external
db.createUser({
  user: "CN=teleport,O=YourOrg",  // Subject DN des Client-Zertifikats
  roles: [
    { role: "readWriteAnyDatabase", db: "admin" }
  ]
})

// Read-only User
db.createUser({
  user: "CN=teleport-ro,O=YourOrg",
  roles: [
    { role: "readAnyDatabase", db: "admin" }
  ]
})

uninstall

Deinstalliert "MongoDB" vom Cluster

polycrate run mongodb uninstall