Deploying MongoDB Ops Manager with a custom resource

After you install the MongoDB service on Cloud Pak for Data, you can use a custom resource (CR) to deploy the MongoDB Ops Manager user interface.

Before you begin

Best practice: You can run the commands in this task exactly as written if you set up environment variables. For instructions, see Setting up installation environment variables.

Ensure that you source the environment variables before you run the commands in this task.

Procedure

  1. Set the following environment variables:
    1. Set the OPS_MANAGER_INSTANCE_NAME environment variable to the name you want to use for this MongoDB Ops Manager instance.
      export OPS_MANAGER_INSTANCE_NAME=<name>
    2. Set the STG_CLASS_BLOCK environment variable to the block storage class you want to use for this instance.
      export STG_CLASS_BLOCK=<storage>
  2. Run the following command to create a secret for logging in to Ops Manager:
    Note: Passwords must be at least 8 characters long and contain at least one letter, one digit, and one special character.
    cat <<EOF | oc apply -n ${PROJECT_CPD_INST_OPERANDS} -f -
    apiVersion: v1
    kind: Secret
    metadata:
      name: mongodb-${OPS_MANAGER_INSTANCE_NAME}-secret
    type: Opaque
    stringData:
      FirstName: "firstnm"
      LastName: "lastnm"
      Password: "Sample@11111111A"
      Username: "sample"
    EOF
  3. Run the following command to deploy the Ops Manager user interface:
    cat <<EOF | oc apply -n ${PROJECT_CPD_INST_OPERANDS} -f -
    apiVersion: mongodb.cpd.ibm.com/v1
    kind: CPDMongoDBOpsManager
    metadata:
      name: ${OPS_MANAGER_INSTANCE_NAME}
    spec:
      forceDeleteResources: false
      license:
        accept: true
      version: 4.0.0
      dedicated: false
      replicas: 2
      storageSize: "2G"
      storageClass: ${STG_CLASS_BLOCK}
      resources:
        requests:
          cpu: "1"
          memory: "5G"
        limits:
          cpu: "4"
          memory: "15G"
      applicationDatabase:
        replicas: 3
        storageSize: "2G"
        storageClass: ${STG_CLASS_BLOCK}
        resources:
          requests:
            cpu: "0.5"
            memory: "500M"
          limits:
            cpu: "1"
            memory: "4G"
    EOF
    Tip:
    • To deploy on dedicated nodes, set the dedicated key under the spec key to true.
    • To automatically remove Persistent Volume Claims (PVCs) and secrets when you delete an instance, set the forceDeleteResources key under the spec key to true.
  4. You can access Ops Manager by using the following methods:
    Using a route:
    Look up the route to the Ops Manager instance. The route is based on the name of your instance.
    oc get routes -n ${PROJECT_CPD_INST_OPERANDS}
    Using a link:
    Get the status of your Ops Manager instance and look for the opsmanagerURL field that contains the link to your instance.
    oc describe cpdmongodbopsmanager <opsManagerInstanceName> -n ${PROJECT_CPD_INST_OPERANDS}

What to do next

After you provision the MongoDB Ops Manager, you can deploy one or more MongoDB database instances. For more information, see Deploying a MongoDB database instance with a custom resource.