OpenShift Quick Start¶
On this page
MongoDB Enterprise Kubernetes Operator uses the Kubernetes API and tools to manage MongoDB clusters. Kubernetes Operator works together with MongoDB Cloud Manager or Ops Manager. This tutorial demonstrates how to deploy and connect to your first replica set in Cloud Manager or Ops Manager from OpenShift with Kubernetes Operator.
Procedure¶
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:
Create a secret that contains credentials authorized to pull images from the registry.connect.redhat.com
repository.¶
If you have not already, obtain a Red Hat subscription.
Create a Registry Service Account.
Click on your Registry Service Account, then click the Docker Configuration tab.
Download the
<account-name>-auth.json
file and open it in a text editor.Copy the
registry.redhat.io
object, and paste another instance of this object into the file. Remember to add a comma after the first object. Rename the second objectregistry.connect.redhat.com
, then save the file:Create a
openshift-pull-secret.yaml
file with the contents of the modified<account-name>-auth.json
file asstringData
named.dockerconfigjson
:The value you provide in the
metadata.name
field contains the secret name. Provide this value when asked for the<openshift-pull-secret>
.Create a secret from the
openshift-pull-secret.yaml
file:
Install the MongoDB Enterprise Kubernetes Operator¶
Invoke the following
oc
command to install the CustomResourceDefinitions for MongoDB deployments:Add your
<openshift-pull-secret>
to theServiceAccount
definitions in the MongoDB Enterprise Kubernetes Operator YAML file:Invoke the following
oc
command to install Kubernetes Operator:
Create credentials and store them as a secret.¶
Run the following command:
Note
Provide your Public and Private Key values for the following parameters. To learn more, see Create Credentials for the Kubernetes Operator.
Invoke the following command to create a ConfigMap.¶
Note
Provide your values for the following parameters. To learn more, see the parameter descriptions.
Deploy the replica set resource.¶
Run the following command:
Create a secret with your database user password¶
You can choose to use a cleartext password or a Base64-encoded
password. Plaintext passwords use stringData.password
and
Base64-encoded passwords use data.password
.
Note
Provide your values for the following parameters. To learn more, see the parameter descriptions.
For a cleartext password, create and save the following YAML file:
For a Base64-encoded password, create and save the following YAML file:
Create a database user.¶
Run the following command:
Optional: View the newly created user in Cloud Manager or Ops Manager.¶
You can view the newly-created user in Cloud Manager or Ops Manager:
- From the Project’s Deployment view, click the Security tab.
- Click the MongoDB Users nested tab.
Connect to the replica set.¶
Perform the following steps in the Cloud Manager or Ops Manager application, depending on where your clusters are hosted:
- Click Deployment in the left navigation.
- Click for the deployment to which you want to connect.
- Click Connect to this instance.
- Run the connection command in a terminal to connect to the deployment.