- Openshift Tutorials >
- OpenShift Quick Start
OpenShift Quick Start¶
On this page
Important
This section is for single Kubernetes cluster deployments only. For multi-Kubernetes-cluster deployments, see Multi-Kubernetes-Cluster Quick Start.
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 use the Kubernetes Operator to deploy MongoDB resources to multiple namespaces or with a cluster-wide scope, create the secret only in the namespace where you intend to deploy the Kubernetes Operator. The Kubernetes Operator synchronizes the secret across all watched namespaces.
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 an
openshift-pull-secret.yaml
file and add the contents of the modified<account-name>-auth.json
file asstringData
named.dockerconfigjson
to theopenshift-pull-secret.yaml
secret file.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 in the same namespace in which you will deploy the Kubernetes Operator.
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.¶
Key | Type | Description | Example |
---|---|---|---|
metadata.name |
string | Name of the Kubernetes object. Resource names must be 44 characters or less. |
my-project |
metadata.namespace |
string | Kubernetes namespace where the Kubernetes Operator creates this
MongoDB resource and other objects. |
mongodb |
data.projectName |
string | Label for your Ops Manager Project. The Kubernetes Operator creates the Ops Manager project if it does
not exist. If you omit the To use an existing project in a Cloud Manager or Ops Manager
organization, locate
the |
myProjectName |
data.orgId |
string | Required. 24 character hex string that uniquely identifies your Cloud Manager or Ops Manager Organization. Important
Specify an existing Organization: 1 Find the organization’s ID.¶Click Settings in the left navigation bar. 2 Copy and paste the orgId into the URL.¶Select your organization, view the current URL
in your browser and copy the value displayed in
the
Note You must have the If you provide an empty string as your |
5b890e0feacf0b76ff3e7183 |
data.baseUrl |
string | URL to your Ops Manager Application including the FQDN and port number. 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 Note If you’re using Cloud Manager, set the |
https://ops.example.com:8443 |
Deploy the replica set resource.¶
Copy and save the following YAML file:
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.¶
Copy and save the following MongoDB User Resource Specification file:
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 application:
- 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.