Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bitnami/mongodb] metrics exporter doesn't work with mTLS #32191

Open
lasseoe opened this issue Feb 27, 2025 · 1 comment · May be fixed by #32192
Open

[bitnami/mongodb] metrics exporter doesn't work with mTLS #32191

lasseoe opened this issue Feb 27, 2025 · 1 comment · May be fixed by #32192
Assignees
Labels
mongodb tech-issues The user has a technical issue about an application triage Triage is needed

Comments

@lasseoe
Copy link

lasseoe commented Feb 27, 2025

Name and Version

bitnami/mongodb 16.4.5

What architecture are you using?

None

What steps will reproduce the bug?

Deploy mongodb with mTLS enabled and custom certificates.

Certificate extensions look like this, and incrementing the number for each pod:
DNS.1 = mongodb-headless
DNS.2 = mongodb-0
DNS.3 = mongodb-0.mongodb-headless.mongo-test.svc.cluster.local

Are you using any custom parameters or values?

architecture: replicaset
auth:
  enabled: true
  usernames:
    - "somedbuser"
  databases:
    - "somedb"
  existingSecret: "mongodb"
tls:
  enabled: true
  mTLS:
    enabled: true
  autoGenerated: false
  mode: requireTLS
  replicaset:
    existingSecrets:
      - mongodb-0-cert
      - mongodb-1-cert
      - mongodb-2-cert
metrics:
  enabled: true
  serviceMonitor:
    enabled: true

What is the expected behavior?

Metrics in Prometheus.

What do you see instead?

No metrics in Prometheus because mongodb_exporter connects to localhost instead of the actual pod hostname. Adding "localhost" to the certificates is not really an option.

time="2025-02-26T19:12:36Z" level=error msg="Cannot connect to MongoDB: cannot connect to MongoDB: server selection error: server selection timeout, current topology: { Type: Single, Servers: [{ Addr: localhost:27017, Type: Unknown, Last error: tls: failed to verify certificate: x509: certificate is valid for mongodb-headless, mongodb-0, mongodb-0.mongodb-headless, mongodb-0.mongodb-headless.mongo-test.svc.cluster.local, not localhost }, ] }"

Additional information

Everything else works just fine with our custom certificates

@lasseoe lasseoe added the tech-issues The user has a technical issue about an application label Feb 27, 2025
@github-actions github-actions bot added the triage Triage is needed label Feb 27, 2025
@carrodher
Copy link
Member

Thank you for opening this issue and submitting the associated Pull Request. Our team will review and provide feedback. Once the PR is merged, the issue will automatically close.

Your contribution is greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mongodb tech-issues The user has a technical issue about an application triage Triage is needed
Projects
None yet
2 participants