Navigation

Configure an Ops Manager Resource to use Local Mode

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

You can configure Ops Manager to run in Local 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 tarballs only from Ops Manager.

This procedure covers uploading installation tarballs to Ops Manager.

Prerequisites and Considerations

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

Procedure

1

Configure kubectl to default to your namespace.

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

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

Copy the highlighted fields of this Ops Manager resource.

The highlighted section:

  • Uses the Ops Manager configuration setting automation.versions.source: local in spec.configuration to enable Local Mode.
  • Defines a Persistent Volume for the Ops Manager StatefulSet to store the MongoDB installation tarball. MongoDB Agents running in MongoDB database resource containers that you create with the Kubernetes Operator download these tarballs from Ops Manager instead of from the Internet.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
apiVersion: mongodb.com/v1
kind: MongoDBOpsManager
metadata:
 name: ops-manager-localmode
spec:
 replicas: 2
 version: 4.2.12
 adminCredentials: ops-manager-admin-secret
 configuration:
   # this enables local mode in Ops Manager
   automation.versions.source: local

 statefulSet:
   spec:
     # the Persistent Volume Claim will be created for each Ops Manager Pod
     volumeClaimTemplates:
       - metadata:
           name: mongodb-versions
         spec:
           accessModes: [ "ReadWriteOnce" ]
           resources:
             requests:
               storage: 20G
     template:
       spec:
         containers:
           - name: mongodb-ops-manager
             volumeMounts:
               - name: mongodb-versions
                 # this is the directory in each Pod where all MongoDB
                 # archives must be put
                 mountPath: /mongodb-ops-manager/mongodb-releases


 backup:
   enabled: false

 applicationDatabase:
   members: 3
   persistent: true
3

Paste the copied example section into your existing Ops Manager resource.

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

4

Save your Ops Manager config file.

5

Apply changes to your Ops Manager deployment.

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

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

Track the status of your Ops Manager instance.

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

kubectl get om -o yaml -w

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

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

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

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.

7

Download the MongoDB installation tarballs to your local machine.

The installers that you download depend on the environment to which you deployed the operator:

Note

The examples below provide you with a link to quickly download the specified versions of MongoDB Community edition and the MongoDB Database tools.

To download MongoDB Enterprise Edition, or any other version of MongoDB Community Edition, visit the MongoDB Download Center.

  1. Download the Ubuntu 16.04 installation tarball for the MongoDB database version you want the Kubernetes Operator to deploy. For example, to download the 4.2.0 release:

    curl -OL https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-4.2.0.tgz
    
  2. If you deployed Ops Manager 4.4.0 and later, you must also download the Ubuntu 16.04 MongoDB Database Tools installation tarball. For example, to download the 100.0.1 release:

    curl -OL https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu1604-x86_64-100.0.1.tgz
    
  1. Download the RHEL 7 installation tarball for the MongoDB database version you want the Kubernetes Operator to deploy. For example, to download the 4.2.0 release:

    curl -OL https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.2.0.tgz
    
  2. If you deployed Ops Manager 4.4.0 and later, you must also download the RHEL 7 MongoDB Database Tools installation tarball. For example, to download the 100.0.1 release:

    curl -OL https://fastdl.mongodb.org/tools/db/mongodb-database-tools-rhel70-x86_64-100.0.1.tgz
    
8

Copy the MongoDB installation tarballs to the Ops Manager Persistent Volume for each Ops Manager replica you deployed.

The commands that you use depend on the environment to which you deployed the operator:

Note

Only copy the MongoDB installation tarballs to Replica 1 and beyond if you deployed more than one Ops Manager replica.

  1. Copy the MongoDB database installation tarball to the Ops Manager PersistentVolume. For example, to copy the 4.2.0 release:

    Replica 0:
    kubectl cp mongodb-linux-x86_64-ubuntu1604-4.2.0.tgz \
    "ops-manager-localmode-0:/mongodb-ops-manager/mongodb-releases/mongodb-linux-x86_64-ubuntu1604-4.2.0.tgz"
    
    Replica 1:
    kubectl cp mongodb-linux-x86_64-ubuntu1604-4.2.0.tgz \
    "ops-manager-localmode-1:/mongodb-ops-manager/mongodb-releases/mongodb-linux-x86_64-ubuntu1604-4.2.0.tgz"
    
  2. If you deployed Ops Manager 4.4.0 and later, copy the MongoDB Database Tools installation tarball to the Ops Manager PersistentVolume. For example, to copy the 100.0.1 release:

    Replica 0:
    kubectl cp mongodb-database-tools-ubuntu1604-x86_64-100.0.1.tgz \
    "ops-manager-localmode-0:/mongodb-ops-manager/mongodb-releases/mongodb-database-tools-ubuntu1604-x86_64-100.0.1.tgz"
    
    Replica 1:
    kubectl cp mongodb-database-tools-ubuntu1604-x86_64-100.0.1.tgz \
    "ops-manager-localmode-1:/mongodb-ops-manager/mongodb-releases/mongodb-database-tools-ubuntu1604-x86_64-100.0.1.tgz"
    
  1. Copy the MongoDB database installation tarball to the Ops Manager PersistentVolume. For example, to copy the 4.2.0 release:

    Replica 0:
    oc rsync  "ops-manager-localmode-0:/mongodb-ops-manager/mongodb-releases/mongodb-linux-x86_64-rhel70-4.2.0.tgz" \
    mongodb-linux-x86_64-rhel70-4.2.0.tgz
    
    Replica 1:
    oc rsync  "ops-manager-localmode-1:/mongodb-ops-manager/mongodb-releases/mongodb-linux-x86_64-rhel70-4.2.0.tgz" \
    mongodb-linux-x86_64-rhel70-4.2.0.tgz
    
  2. If you deployed Ops Manager 4.4.0 and later, copy the MongoDB Database Tools installation tarball to the Ops Manager PersistentVolume. For example, to copy the 100.0.1 release:

    Replica 0:
    kubectl cp mongodb-database-tools-ubuntu1604-x86_64-100.0.1.tgz \
    "ops-manager-localmode-0:/mongodb-ops-manager/mongodb-releases/mongodb-database-tools-ubuntu1604-x86_64-100.0.1.tgz"
    
    Replica 1:
    kubectl cp mongodb-database-tools-rhel70-x86_64-100.0.1.tgz \
    "ops-manager-localmode-1:/mongodb-ops-manager/mongodb-releases/mongodb-database-tools-rhel70-x86_64-100.0.1.tgz"
    
9

Deploy a MongoDB Database Resource.

  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.

The Kubernetes Operator downloads the installation tarballs for the MongoDB Database resources from the Ops Manager Persistent Volumes instead of from the Internet.