Docs Menu
Docs Home
/
MongoDB Enterprise Kubernetes Operator
/

Configure an Ops Manager Resource to use Remote Mode

On this page

In a default configuration, the MongoDB Agents and Backup Daemons access MongoDB installation archives over the Internet from MongoDB, Inc.

You can configure Ops Manager to run in Remote Mode with the Kubernetes Operator if the nodes in your Kubernetes cluster don't have access to the Internet. The Backup Daemons and managed MongoDB resources download installation archives only from Ops Manager, which proxies download requests to an HTTP endpoint on a local web server or S3-compatible store deployed to your Kubernetes cluster.

This procedure covers deploying an Nginx HTTP server to your Kubernetes cluster to host the MongoDB installation archives.

Deploy an Ops Manager Resource. The following procedure shows you how to update your Ops Manager Kubernetes object to enable Remote Mode.

1

If you have not already, run the following command to execute all kubectl commands in the namespace you created.

Note

If you are deploying an Ops Manager resource in a multi-Kubernetes cluster MongoDB deployment:

  • Set the context to the name of the central cluster, such as: kubectl config set context "$MDB_CENTRAL_CLUSTER_FULL_NAME".

  • Set the --namespace to the same scope that you used for your multi-Kubernetes cluster MongoDB deployment, such as: kubectl config --namespace "mongodb".

kubectl config set-context $(kubectl config current-context) --namespace=<metadata.namespace>
2

The ConfigMap in this tutorial configures Nginx to:

  • Run an HTTP server named localhost listening on port 80 on a node in your Kubernetes cluster, and

  • Route HTTP requests for specific resources to locations that serve the the MongoDB Server and MongoDB Database Tools installation archives.

  1. Paste the following example Nginx ConfigMap into a text editor:

    1---
    2apiVersion: v1
    3kind: ConfigMap
    4metadata:
    5 name: nginx-conf
    6data:
    7 nginx.conf: |
    8 events {}
    9 http {
    10 server {
    11 server_name localhost;
    12 listen 80;
    13 location /linux/ {
    14 alias /mongodb-ops-manager/mongodb-releases/linux/;
    15 }
    16 location /tools/ {
    17 alias /tools/;
    18 }
    19 }
    20 }
    21...
  2. Save this file with a .yaml file extension.

  3. Create the Nginx ConfigMap by invoking the following kubectl command on the ConfigMap file you created:

    kubectl apply -f <nginix-configmap>.yaml
3

The Nginx resource configuration in this tutorial:

  • Deploys one Nginx replica,

  • Creates volume mounts to store MongoDB Server and MongoDB Database Tools installation archives, and

  • Defines init containers that use curl commands to download the installation archives that Nginx serves to MongoDB Database resources you deploy in your Kubernetes cluster.

4

The service in this tutorial exposes Nginx to traffic from other nodes in your Kubernetes cluster over port 80. This allows the MongoDB Database resource pods you deploy using the Kubernetes Operator to download the installation archives from Nginx.

Run the following command to create a service your Nginx deployment:

  1. Paste the following example service into a text editor:

    1---
    2apiVersion: v1
    3kind: Service
    4metadata:
    5 name: nginx-svc
    6 labels:
    7 app: nginx
    8spec:
    9 ports:
    10 - port: 80
    11 protocol: TCP
    12 selector:
    13 app: nginx
    14...
  2. Save this file with a .yaml file extension.

  3. Create the service by invoking the following kubectl command on the service file you created:

    kubectl apply -f <nginix-service>.yaml
5

The highlighted section uses the following Ops Manager configuration settings:

  • automation.versions.source: remote in spec.configuration to enable Remote Mode.

  • automation.versions.download.baseUrl in spec.configuration to provide the base URL of the HTTP resources that serve the MongoDB installation archives.

    Update this line to replace <namespace> with the namespace to which you deploy resources with the Kubernetes Operator.

  • automation.versions.download.baseUrl.allowOnlyAvailableBuilds: "false" in spec.configuration to help ensure enterprise builds have no issues.

1---
2apiVersion: mongodb.com/v1
3kind: MongoDBOpsManager
4metadata:
5 name: ops-manager-localmode
6spec:
7 replicas: 1
8 version: "6.0.0"
9 adminCredentials: ops-manager-admin-secret
10 configuration:
11 # this enables remote mode in Ops Manager
12 automation.versions.source: remote
13 automation.versions.download.baseUrl: "http://nginx-svc.<namespace>.svc.cluster.local:8080"
14
15 backup:
16 enabled: false
17
18 applicationDatabase:
19 members: 3
20...
6

Open your preferred text editor and paste the object specification into the appropriate location in your resource file.

7
8

Invoke the following kubectl command on the filename of the Ops Manager resource definition:

kubectl apply -f <opsmgr-resource>.yaml
9

To check the status of your Ops Manager resource, invoke the following command:

kubectl get om -o yaml -w

See Troubleshoot the Kubernetes Operator for information about the resource deployment statuses.

After the Ops Manager resource completes the Pending phase, the command returns output similar to the following:

1status:
2 applicationDatabase:
3 lastTransition: "2020-05-15T16:20:22Z"
4 members: 3
5 phase: Running
6 type: ReplicaSet
7 version: "4.4.5-ubi8"
8 backup:
9 phase: ""
10 opsManager:
11 lastTransition: "2020-05-15T16:20:26Z"
12 phase: Running
13 replicas: 1
14 url: http://ops-manager-localmode-svc.mongodb.svc.cluster.local:8080
15 version: "6.0.0"

Copy the value of the status.opsManager.url field, which states the resource's connection URL. You use this value when you create a ConfigMap later in the procedure.

10
  1. If you have not done so already, complete the following prerequisites:

  2. Deploy a MongoDB Database resource in the same namespace to which you deployed Ops Manager. Ensure that you:

    1. Match the spec.opsManager.configMapRef.name of the resource to the metadata.name of your ConfigMap.

    2. Match the spec.credentials of the resource to the name of the secret you created that contains an Ops Manager programmatic API key pair.

MongoDB Agents running in MongoDB database resource containers that you create with the Kubernetes Operator download the installation archives from Ops Manager via Nginx instead of from the Internet.

← Deploy an Ops Manager Resource