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 Agent's and Backup Daemons access MongoDB installation archives over the Internet from MongoDB, Inc.

You can configure Ops Manager to run in Remote Mode so that 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.

Deploy an Ops Manager Resource.

The following procedure deploys an Nginx HTTP server to your Kubernetes cluster to host the MongoDB installation archives.

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.

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

    1---
    2apiVersion: apps/v1
    3kind: Deployment
    4metadata:
    5 name: nginx-deployment
    6spec:
    7 replicas: 1
    8 selector:
    9 matchLabels:
    10 app: nginx
    11 template:
    12 metadata:
    13 labels:
    14 app: nginx
    15 spec:
    16 containers:
    17 - image: nginx:1.14.2
    18 imagePullPolicy: IfNotPresent
    19 name: nginx
    20 ports:
    21 - containerPort: 80
    22 volumeMounts:
    23 - mountPath: /mongodb-ops-manager/mongodb-releases/linux
    24 name: mongodb-versions
    25 - mountPath: /tools/db/
    26 name: mongodb-tools
    27 - name: nginx-conf
    28 mountPath: /etc/nginx/nginx.conf
    29 subPath: nginx.conf
    30 initContainers:
    31 - name: setting-up-rhel-mongodb
    32 image: curlimages/curl:latest
    33 command:
    34 - curl
    35 - -L
    36 - https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-6.0.1.tgz
    37 - -o
    38 - /mongodb-ops-manager/mongodb-releases/linux/mongodb-linux-x86_64-rhel80-6.0.1.tgz
    39 volumeMounts:
    40 - name: mongodb-versions
    41 mountPath: /mongodb-ops-manager/mongodb-releases/linux
    42 - name: setting-up-rhel-mongodb-tools
    43 image: curlimages/curl:latest
    44 command:
    45 - curl
    46 - -L
    47 - https://fastdl.mongodb.org/tools/db/mongodb-database-tools-rhel80-x86_64-100.6.0.tgz
    48 - -o
    49 - /tools/db/mongodb-database-tools-rhel80-x86_64-100.6.0.tgz
    50 volumeMounts:
    51 - name: mongodb-tools
    52 mountPath: /tools/db/
    53 restartPolicy: Always
    54 terminationGracePeriodSeconds: 30
    55 volumes:
    56 - name: mongodb-versions
    57 emptyDir: {}
    58 - name: mongodb-tools
    59 emptyDir: {}
    60 - configMap:
    61 name: nginx-conf
    62 name: nginx-conf
    63...
  2. Modify the lines highlighted in the example to specify the MongoDB Server versions that you want to install.

    For example, to replace MongoDB version 4.0.2 with a different database version, update the following block:

    - name: setting-up-rhel-mongodb
    image: curlimages/curl:latest
    command:
    - curl
    - -L
    - https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-6.0.1.tgz
    - -o
    - /mongodb-ops-manager/mongodb-releases/linux/mongodb-linux-x86_64-rhel80-6.0.1.tgz

    Update this block to modify the MongoDB Database Tools version:

    - name: setting-up-rhel-mongodb-tools
    image: curlimages/curl:latest
    command:
    - curl
    - -L
    - https://fastdl.mongodb.org/tools/db/mongodb-database-tools-rhel80-x86_64-100.6.0.tgz
    - -o
    - /tools/db/mongodb-database-tools-rhel80-x86_64-100.6.0.tgz
  3. To load multiple versions, append curl commands

    to the appropriate initContainer for each version you want Nginx to serve.

    For example, to configure Nginx to serve MongoDB 6.0.1:

    - name: setting-up-rhel-mongodb
    image: curlimages/curl:latest
    command:
    - curl
    - -L
    - https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-6.0.1.tgz
    - -o
    - /mongodb-ops-manager/mongodb-releases/linux/mongodb-linux-x86_64-rhel80-6.0.1.tgz
  4. Save this file with a .yaml file extension.

  5. Deploy Nginx by invoking the following kubectl command on the Nginx resource file you created:

    kubectl apply -f <nginix>.yaml
  1. Paste the following example Nginx resource configuration into a text editor:

    1---
    2apiVersion: apps/v1
    3kind: Deployment
    4metadata:
    5 name: nginx-deployment
    6spec:
    7 replicas: 1
    8 selector:
    9 matchLabels:
    10 app: nginx
    11 template:
    12 metadata:
    13 labels:
    14 app: nginx
    15 spec:
    16 containers:
    17 - image: nginx:1.14.2
    18 imagePullPolicy: IfNotPresent
    19 name: nginx
    20 ports:
    21 - containerPort: 80
    22 volumeMounts:
    23 - mountPath: /mongodb-ops-manager/mongodb-releases/linux
    24 name: mongodb-versions
    25 - mountPath: /tools/db/
    26 name: mongodb-tools
    27 - name: nginx-conf
    28 mountPath: /etc/nginx/nginx.conf
    29 subPath: nginx.conf
    30 initContainers:
    31 - name: setting-up-rhel-mongodb
    32 image: curlimages/curl:latest
    33 command:
    34 - curl
    35 - -L
    36 - https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel<version>-4.2.0.tgz
    37 - -o
    38 - /mongodb-ops-manager/mongodb-releases/linux/mongodb-linux-x86_64-rhel<version>-4.2.0.tgz
    39 volumeMounts:
    40 - name: mongodb-versions
    41 mountPath: /mongodb-ops-manager/mongodb-releases/linux
    42 - name: setting-up-rhel-mongodb-tools
    43 image: curlimages/curl:latest
    44 command:
    45 - curl
    46 - -L
    47 - https://fastdl.mongodb.org/tools/db/mongodb-database-tools-rhel<version>-x86_64-100.1.0.tgz
    48 - -o
    49 - /tools/db/mongodb-database-tools-rhel<version>-x86_64-100.1.0.tgz
    50 volumeMounts:
    51 - name: mongodb-tools
    52 mountPath: /tools/db/
    53 restartPolicy: Always
    54 terminationGracePeriodSeconds: 30
    55 volumes:
    56 - name: mongodb-versions
    57 emptyDir: {}
    58 - name: mongodb-tools
    59 emptyDir: {}
    60 - configMap:
    61 name: nginx-conf
    62 name: nginx-conf
    63...
  2. Modify the lines highlighted in the example to specify the MongoDB Server versions that you want to install.

    For example, to replace MongoDB version 4.0.2 with a different database version, update the following block:

    - name: setting-up-rhel-mongodb
    image: curlimages/curl:latest
    command:
    - curl
    - -L
    - https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel<version>-4.2.0.tgz
    - -o
    - /mongodb-ops-manager/mongodb-releases/linux/mongodb-linux-x86_64-rhel<version>-4.2.0.tgz

    Update this block to modify the MongoDB Database Tools version:

    - name: setting-up-rhel-mongodb-tools
    image: curlimages/curl:latest
    command:
    - curl
    - -L
    - https://fastdl.mongodb.org/tools/db/mongodb-database-tools-rhel<version>-x86_64-100.1.0.tgz
    - -o
    - /tools/db/mongodb-database-tools-rhel<version>-x86_64-100.1.0.tgz
  3. To load multiple versions, append curl commands to the appropriate initContainer for each version you want Nginx to serve.

    For example, to configure Nginx to serve MongoDB 6.0.1:

    - name: setting-up-rhel-mongodb
    image: curlimages/curl:latest
    command:
    - curl
    - -L
    - https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-6.0.1.tgz
    - -o
    - /mongodb-ops-manager/mongodb-releases/linux/mongodb-linux-x86_64-rhel80-6.0.1.tgz
  4. Save this file with a .yaml file extension.

  5. Deploy Nginx by invoking the following oc command on the Nginx resource file you created:

    oc apply -f <nginix>.yaml
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 Agent's 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.

Back

Deploy an

Next

Configure an