Configure hostnames for a DNS server for a
MongoDB Community
instance

To make a
MongoDB Community
cluster reachable externally by hostnames, you must configure hostnames for the DNS server for
VMware Cloud Director extension for Data Solutions
.

How to configure hostnames for DNS server for a
MongoDB Community
instance

To deploy
MongoDB Community
instances with a service load balancer, you must configure hostnames for the replica nodes.
  1. Log in to
    VMware Cloud Director extension for Data Solutions
    from
    VMware Cloud Director
    .
  2. Click
    Instances
    New Instance
    .
  3. Enter the necessary details.
  4. Click
    Show Advanced Settings
    .
    1. Select
      Expose Service by Load Balancer
      .
      Verify that
      Enable TLS
      is checked and locked.
    2. In Replica Node, enter the hostnames that will be used to connect externally or internally to
      MongoDB
      from the
      Kubernetes
      cluster.
      For example,
      replica-0.mongodb.local
      ,
      replica-1.mongodb.local
      , and
      replica-2.mongodb.local
      .
    3. Select a PVC policy and click
      Create
      .
  5. In the
    Instances
    menu, verify the status of the new
    MongoDB Community
    is running.
  6. Click the instance name and click
    Resource Details
    .
  7. Navigate to
    Address
    and note down the value.
    For example,
    10.138.110.100:27017,10.138.110.101:27017,10.138.110.102:27017, replica-0.mongodb.local:27017, replica-1.mongodb.local:27017, and replica-2.mongodb.local:27017
    .
The
MongoDB Community
instance is deployed successfully, but you are not able to visit
MongoDB
by using hostnames. You must configure your upstream DNS server or custom DNS server.
Configure your upstream DNS server or custom DNS server. See Configure an upstream DNS server or a custom DNS server.

Configure an upstream DNS server or a custom DNS server

To complete the configuration of hostnames for the replica nodes, you must configure the DNS server.
  1. Add the DNS server forward record into
    Kubernetes
    cluster’s ConfigMap
    coredns
    .
  2. Add the hostname to IP mappings of the
    MongoDB
    cluster to the DNS server.
    For example:
    • 10.138.110.100 --> replica-0.mongodb.local
    • 10.138.110.101 --> replica-1.mongodb.local
    • 10.138.110.102 --> replica-2.mongodb.local
  3. Add the DNS server to the
    MongoDB
    client machine.