Skip to content

Latest commit

 

History

History
256 lines (188 loc) · 8.61 KB

README.md

File metadata and controls

256 lines (188 loc) · 8.61 KB

This post and code are quite old.

Please see the offical MongoDB Kubernetes docs:


mongodb-openshift-dev-preview

+ STATUS: Updates! New test MongoDB Ops Manager install and OpenShift Template!
- STATUS: Work In Progress...

This is the MongoDB Enterprise Openshift "Developer Preview".

The contents of this repository demonstrate a functional integration between the Red Hat OpenShift PaaS and MongoDB Enterprise. You can now spin up MongoDB Enterprise replica sets within your own OpenShift environment with the click of a button.

WARNING! This repository is for demonstration purposes only. No assumptions should be made between this particular implementation and future supported products from MongoDB, Inc. Do not use this in anything close to a production environment. All support, as it is, takes a standard open-source model. Anyone interested can contribute through GitHub.

Updates

May 13, 2018 A new design strategy for deploying MongoDB clusters within OpenShift has been added to the preview in anticipation of more official support for Kubernetes in upcoming MongoDB Ops Manager releases. The new strategy is much simpler for developers and OpenShift operators as it removes the dependency on enabling the --service-catalog, installing the Ansible Service Broker, and any need to install additional client-side tooling. It consists of a simple OpenShift template which contains configuration parameters for accessing an instance of Ops Manager and for the desired MongoDB replica set.

The new additions to the developer preview also contain a simple test installation of Ops Manager to allow you to run Ops Manager directly in your OpenShift (or basic Kubernetes) cluster. Ops Manager is deployed into 2 pods, each with a single container. One runs a stand-alone instance of MongoDB to serve as the application database for Ops Manager. The other runs a single instance of the Ops Manager HTTP service (There is no backup daemon deployed in this demonstration.)

Additional details and getting started notes can be found in the ./simple-test-opsmanager-k8s folder in the repo.

Introduction

The artifacts within allow one to provision MongoDB replica sets and agents-only pods into OpenShift. It leverages MongoDB Ops Manager for automation, monitoring, alerting, and backup functionality. The basic design uses OpenShift to provision pods, each with 1 container running an instance of an automation agent. Then REST API calls to MongoDB Ops Manager are invoked which, in turn, install MongoDB instances into each pod and configures the desired cluster.

Being a "developer preview" these artifacts can be treated as a "functional prototype". Here we mean, this demonstrates functionally how future MongoDB-supported product(s) will operate. The actual implementation of any such future product(s) is yet to be determined.

OpenShift specific, we use the new(er) Ansible Service Broker available in OpenShift v3.7+. This broker registered services to a central Service Catalog. The services are packaged as Ansible Playbook Bundles. This handiwork constitutes the majority of the files in this repository.

NOTE! Being a new, 'prototype' project there are a number of detailed steps required in order to use these components. Please be sure to read this entire README before attempting to get started. Patience, young jedi, we call 'em README's for a reason.

Getting Started

Prerequisites

  • A working MongoDB Ops Manager installation. Run through the install a simple test deployment instructions, and then see Ops Manager setup for additional configuration steps.

  • A working OpenShift environment, with the Ansible Service Broker. A greate place to find info on building your development environment is in the APB Getting Started.

  • Please see the Dependencies section for details on specific versions of software used.

  • Consult the Development Environement section for tips on setting up your own development environment.

  • Finally, clone this repo

$git clone https://github.com/jasonmimick/mongodb-openshift-dev-preview

Installing & Running the APB

We typically used these commands to test the mongodb-enterprise apb. For some reason, we needed to run the apb push command multiple times in order for it to appear in the OpenShift web-console.

apb build && apb push && apb push --push-to-broker
apb run --project default --action provision

The apb run command is an interactive command in which you will be prompted to enter the various configuration parameters.

Troubleshooting

  • You can check the apb loaded correctly by running, apb list. Make sure it appears. Also to validate the service has been picked up by the lower level ServiceCatalog, run
 oc get clusterserviceclasses -o=custom-columns=SERVICE\ NAME:.metadata.name,EXTERNAL\ NAME:.spec.externalName,TS:.metadata.creationTimestamp | grep mongo

(The above produces a decently human readable output.) Be sure to check the timestamp. By default the ansible-service-broker only updates the ServiceCatalog every 15 mins. You can change this behavior, consult the relistDuration attribute.

To check:

oc get clusterservicebrokers ansible-service-broker -o yaml

To edit:

oc edit clusterservicebroker ansible-service-broker

Dependencies

  • OpenShift 3.7+ with --service-catalog=true
    • oc cli
  • MongoDB Ops Manager 3.6+
  • apb cli
  • Docker Version 17.09.0-ce-mac35 (19611)
    • Some issue with very latest version for Mac

Also see Issues for more tips.

Development Environment Tips

Note: All development was done on macOS Sierra 10.12.6

Here's a sample script to bootstrap your local OpenShift environment:

#!/bin/bash

oc --loglevel 3 cluster up --service-catalog=true
# run_latest_build.sh comes from the APB repo
./run_latest_build.sh
oc login --insecure-skip-tls-verify -u admin -p admin

oc login -u system:admin
oc adm policy add-scc-to-user anyuid -z default
oc adm policy add-scc-to-group anyuid system:authenticated
oc adm policy add-cluster-role-to-user cluster-admin developer
oc adm policy add-cluster-role-to-user cluster-admin admin

oc login -u developer -p developer
OPENSHIFT_TOKEN=$(oc whoami -t)
docker login -u developer -p ${OPENSHIFT_TOKEN} 172.30.1.1:5000

Ops Manager Setup

  • Enable Public API access for your account
    • Create an API key & save to use to in configuration while provisioning
    • Add appropriate ips or 0.0.0.0/0 to the IP Whitelist

Known Issues & Limitations

List of issues, Limitations, and to-dos.

All issues and limitations have moved to the Issues part of this repo.

Contacts

For technical questions, issues, sales and marketing support, or just comments please email [email protected] and [email protected].

Disclaimer

This software is not supported by MongoDB, Inc. under any of their commercial support subscriptions or otherwise. Any usage of the mongodb-openshift-dev-preview is at your own risk. Bug reports, feature requests and questions can be posted in the Issues section on GitHub.