Navigation
This version of the documentation is archived and no longer supported. To learn how to upgrade your version of MongoDB Kubernetes Operator, refer to the upgrade documentation.

Deploy an Ops Manager Resource

You can deploy Ops Manager in a container with the Kubernetes Operator.

Prerequisites and Considerations

Before you deploy an Ops Manager resource, make sure you plan for your Ops Manager resource:

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 following example Ops Manager Kubernetes object.

Change the highlighted settings to match your desired Ops Manager configuration.

 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: <myopsmanager>
spec:
  replicas: 1
  version: <opsmanagerversion>
  adminCredentials: <adminusercredentials> # Should match metadata.name
                                           # in the Kubernetes secret
                                           # for the admin user
  backup:
    enabled: true
    opLogStores:
      - name: <oplogname>
        mongodbResourceRef:
          name: <oplogresourcename> # Should match metadata.name
                                    # in the MongoDB database resource
                                    # for the oplog store
    s3Stores:
      - name: <s3storename>
        mongodbResourceRef:
          name: <s3storeresourcename> # Should match metadata.name
                                      # in the MongoDB database resource
                                      # for the snapshot store
        s3SecretRef:
          name: <awss3credentials> # Should match metadata.name
                                   # in the Kubernetes secret
                                   # for your |aws| credentials
        s3BucketEndpoint: <s3.region.amazonaws.com>
        s3BucketName: <bucketname>

  externalConnectivity:
    type: LoadBalancer

  applicationDatabase:
    members: 3
    version: <mongodbversion>
    persistent: true
...
3

Open your preferred text editor and paste the object specification into a new text file.

4

Configure the settings highlighted in the prior example.

Key Type Description Example
metadata.name string

Name for this Kubernetes Ops Manager object.

Resource names must be 44 characters or less.

See also

om
spec.replicas number

Number of Ops Manager instances to run in parallel.

The minimum valid value is 1.

Highly Available Ops Manager Resources

For high availability, set this value to more than 1. Multiple Ops Manager instances can read from the same Application Database, ensuring failover if one instance is unavailable and enabling you to update the Ops Manager resource without downtime.

1
spec.version string

Version of Ops Manager to be installed.

The format should be X.Y.Z. To view available Ops Manager versions, view the container registry.

4.2.6
spec.adminCredentials string

Name of the secret you created for the Ops Manager admin user.

Note

Configure the secret to use the same namespace as the Ops Manager resource.

om-admin-secret
spec
.backup
boolean Flag that indicates that Backup is enabled for your You must specify spec.backup.enabled: true to configure settings for the head database, oplog store, and snapshot store. true
spec
.backup
.opLogStores
string Name of the oplog store. oplog1
spec
.backup
.opLogStores
.mongodbRef
string Name of the MongoDB database resource for the oplog store. my-oplog-db
spec
.backup
.s3Stores
string Name of the S3 snapshot store. s3store1
spec
.backup
.s3Stores
.mongodbResourceRef
string Name of the MongoDB database resource for the S3 snapshot store metadata. my-s3-metadata-db
spec
.backup
.s3Stores
.s3SecretRef
string Name of the secret that contains the accessKey and secretKey fields. The Backup Daemon Service uses the values of these fields as credentials to access the S3 or S3-compatible bucket. my-s3-credentials
spec
.backup
.s3Stores
string URL of the S3 or S3-compatible bucket that stores the database Backup snapshots. s3.us-east-1.amazonaws.com
spec
.backup
.s3Stores
string Name of the S3 or S3-compatible bucket that stores the database Backup snapshots. my-bucket
spec
.externalConnectivity
string

Optional.

The Kubernetes service ServiceType that exposes Ops Manager outside of Kubernetes.

Note

Exclude the spec.externalConnectivity setting and its children if you don’t want the Kubernetes Operator to create a Kubernetes service to route external traffic to the Ops Manager application.

LoadBalancer
spec
.applicationDatabase
integer Number of members of the Ops Manager Application Database replica set. 3
spec
.applicationDatabase
string

Optional.

Version of MongoDB that the Ops Manager Application Database should run.

The format should be X.Y.Z for the Community edition and X.Y.Z-ent for the Enterprise edition.

Deploy Ops Manager Resource Offline

To deploy Ops Manager inside Kubernetes without an Internet connection, omit this setting or leave the value empty. The Kubernetes Operator installs the bundled MongoDB Enterprise version 4.2.2 by default.

To learn more about MongoDB versioning, see see MongoDB Versioning in the MongoDB Manual.

4.2.2-ent
spec
.applicationDatabase
boolean

Optional.

Flag indicating if this MongoDB Kubernetes resource should use Persistent Volumes for storage. Persistent volumes are not deleted when the MongoDB Kubernetes resource is stopped or restarted.

If this value is true, then spec.applicationDatabase.podSpec.persistence. single is set to its default value of 16Gi.

To change your Persistent Volume Claims configuration, configure the following collections to meet your deployment requirements:

  • If you want one Persistent Volume for each pod, configure the spec.applicationDatabase. single collection.

  • If you want separate Persistent Volumes for data, journals, and logs for each pod, configure the following collections:

    • spec.applicationDatabase
      .podSpec.persistence.multiple.
    • spec.applicationDatabase
      .podSpec.persistence.multiple.
    • spec.applicationDatabase
      .podSpec.persistence.multiple.

Warning

Grant your containers permission to write to your Persistent Volume. The Kubernetes Operator sets fsGroup = 2000 in securityContext This makes Kubernetes try to fix write permissions for the Persistent Volume. If redeploying the resource does not fix issues with your Persistent Volumes, contact MongoDB support.

true
5

(Optional) Configure any additional settings for an Ops Manager deployment.

Add any optional settings that you want to apply to your deployment to the object specification file.

6

Save this file with a .yaml file extension.

7

Create your Ops Manager instance.

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

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

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

The command returns the following output under the status field while the resource deploys:

status:
 applicationDatabase:
  lastTransition: "2019-11-15T19:48:01Z"
  message: AppDB Statefulset is not ready yet
  phase: Reconciling
  type: ""
  version: ""
 opsManager:
  lastTransition: "2019-11-15T19:48:01Z"
  message: Ops Manager is still starting
  phase: Reconciling
  version: ""

After the resource completes the Reconciling phase, the command returns the following output under the status field:

 status:
   applicationDatabase:
     lastTransition: "2019-12-06T18:23:22Z"
     members: 3
     phase: Running
     type: ReplicaSet
     version: 4.2.2-ent
   opsManager:
     lastTransition: "2019-12-06T18:23:26Z"
     message: The MongoDB object namespace/oplogdbname doesn't exist
     phase: Pending
     url: http://om-svc.dev.svc.cluster.local:8080
     version: ""

The Ops Manager Application remains in a Pending state until you configure the Backup databases.

Tip

The status.opsManager.url field states the resource’s connection URL. Using this URL, you can reach Ops Manager from inside the Kubernetes cluster or create a project using a ConfigMap.

9

Access the Ops Manager application.

The steps you take differ based on how you are routing traffic to the Ops Manager application in Kubernetes. If you configured the Kubernetes Operator to create a Kubernetes service for you, or you created a Kubernetes service manually, use one of the following methods to access the Ops Manager application:

  1. Query your cloud provider to get the FQDN of the load balancer service. See your cloud provider’s documentation for details.

  2. Open a browser window and navigate to the Ops Manager application using the FQDN and port number of your load balancer service.

    http://ops.example.com:8080
    
  3. Log in to Ops Manager using the admin user credentials.

  1. Set your firewall rules to allow access from the Internet to the spec.externalConnectivity.port on the host on which your Kubernetes cluster is running.

  2. Open a browser window and navigate to the Ops Manager application using the FQDN and the spec.externalConnectivity.port.

    http://ops.example.com:30036
    
  3. Log in to Ops Manager using the admin user credentials.

To learn how to access the Ops Manager application using a third-party service, refer to the documentation for your solution.

10

Create credentials for the Kubernetes Operator.

To configure credentials, you must create an Ops Manager organization, generate programmatic API keys, and create a secret. These activities follow the prerequisites and procedure on the Create Credentials for the Kubernetes Operator page.

11

Create a project using a ConfigMap.

To create a project, follow the prerequisites and procedure on the Create One Project using a ConfigMap page.

You must set data.baseUrl in the ConfigMap to the Ops Manager Application’s URL. To find this URL, invoke the following command:

kubectl get om -o yaml -w

The command returns the URL of the Ops Manager Application in the status.opsManager.url field.

 status:
   applicationDatabase:
     lastTransition: "2019-12-06T18:23:22Z"
     members: 3
     phase: Running
     type: ReplicaSet
     version: 4.2.2-ent
   opsManager:
     lastTransition: "2019-12-06T18:23:26Z"
     message: The MongoDB object namespace/oplogdbname doesn't exist
     phase: Pending
     url: http://om-svc.dev.svc.cluster.local:8080
     version: ""

Important

If you deploy Ops Manager with the Kubernetes Operator and Ops Manager will manage MongoDB database resources deployed outside of the Kubernetes cluster it’s deployed to, you must set data.baseUrl to the same value of the spec.configuration.mms.centralUrl setting in the Ops Manager resource specification.

12

Deploy MongoDB database resources to complete the Backup configuration.

By default, Ops Manager enables Backup. Create a MongoDB database resource for the oplog and snapshot stores to complete the configuration.

  1. Deploy a MongoDB database resource for the oplog store in the same namespace as the Ops Manager resource.

    Note

    Create this database as a three-member replica set.

    Match the metadata.name of the resource with the spec.backup.opLogStores.mongodbResourceRef.name that you specified in your Ops Manager resource definition.

  2. Deploy a MongoDB database resource for the S3 snapshot store in the same namespace as the Ops Manager resource.

    Note

    Create the S3 snapshot store as a replica set.

    Match the metadata.name of the resource to the spec.backup.s3Stores.mongodbResourceRef.name that you specified in your Ops Manager resource definition.

13

Confirm that the Ops Manager resource is running.

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

kubectl get om -o yaml -w

When the Ops Manager is running, the command returns the following output under the status field:

status:
  applicationDatabase:
    lastTransition: "2019-12-06T17:46:15Z"
    members: 3
    phase: Running
    type: ReplicaSet
    version: 4.2.2-ent
  opsManager:
    lastTransition: "2019-12-06T17:46:32Z"
    phase: Running
    replicas: 1
    url: http://om-backup-svc.dev.svc.cluster.local:8080
    version: 4.2.6

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