Skip to content

Commit

Permalink
[Documentation][Add] Added installation steps in the documentation (#25)
Browse files Browse the repository at this point in the history
* Updated documentation with installation steps

Signed-off-by: iamabhishek-dubey <abhishekbhardwaj510@gmail.com>
  • Loading branch information
iamabhishek-dubey committed Jan 30, 2022
1 parent 6f37901 commit 39badfa
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/content/en/_index.html
Expand Up @@ -6,7 +6,7 @@

{{< blocks/cover title="MongoDB Operator" image_anchor="top" color="dark" >}}
<div class="mx-auto">
<p class="lead mt-5">The Machine Learning Toolkit for Kubernetes</p>
<p class="lead mt-5">A Kubernetes Operator for MongoDB Database</p>
<a class="btn btn-lg btn-primary mr-3 mb-4" href="{{< relref "/docs" >}}">
Learn More <i class="fas fa-arrow-alt-circle-right ml-2"></i>
</a>
Expand Down
7 changes: 7 additions & 0 deletions docs/content/en/docs/Getting Started/_index.md
@@ -0,0 +1,7 @@
---
title: "Getting Started"
linkTitle: "Getting Started"
weight: 2
description: >
For guide to install, setup and manage MongoDB Operator
---
87 changes: 87 additions & 0 deletions docs/content/en/docs/Getting Started/installation.md
@@ -0,0 +1,87 @@
---
title: "Installation"
weight: 2
linkTitle: "Installation"
description: >
MongoDB Operator installation, upgrade guide
---

MongoDB operator is based on the CRD framework of Kubernetes, for more information about the CRD framework please refer to the [official documentation](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/). In a nutshell, CRD is a feature through which we can develop our own custom API's inside Kubernetes.

The API versions for MongoDB Operator available are:-

- MongoDB
- MongoDBCluster

MongoDB Operator requires a Kubernetes cluster of version >=1.16.0. If you have just started with the CRD and Operators, its highly recommended using the latest version of Kubernetes.

Setup of MongoDB operator can be easily done by using simple [helm](https://helm.sh) and [kubectl](https://kubernetes.io/docs/reference/kubectl/overview/) commands.

{{< alert title="Note" >}}The recommded of way of installation is helm.{{< /alert >}}

## Helm

The setup can be done by using helm. The mongodb-operator can easily get installed using helm commands.

```shell
# Add the helm chart
$ helm repo add ot-helm https://ot-container-kit.github.io/helm-charts/
...
"ot-helm" has been added to your repositories
```

```shell
# Deploy the MongoDB Operator
$ helm upgrade mongodb-operator ot-helm/mongdb-operator \
--install --namespace ot-operators --install
...
Release "mongodb-operator" does not exist. Installing it now.
NAME: mongodb-operator
LAST DEPLOYED: Sun Jan 9 23:05:13 2022
NAMESPACE: ot-operators
STATUS: deployed
REVISION: 1
```

Once the helm chart is deployed, we can test the status of operator pod by using:

```shell
# Testing Operator
$ helm test mongodb-operator --namespace ot-operators
...
NAME: mongodb-operator
LAST DEPLOYED: Sun Jan 9 23:05:13 2022
NAMESPACE: ot-operators
STATUS: deployed
REVISION: 1
TEST SUITE: mongodb-operator-test-connection
Last Started: Sun Jan 9 23:05:54 2022
Last Completed: Sun Jan 9 23:06:01 2022
Phase: Succeeded
```

## Kubectl

In any case using helm chart is not a possiblity, the MongoDB operator can be installed by `kubectl` commands as well.

As a first step, we need to setup a namespace and then deploy the CRD definitions inside Kubernetes.

```shell
$ kubectl create namespace ot-operators
$ kubectl apply -f https://github.com/OT-CONTAINER-KIT/mongodb-operator/raw/main/config/crd/bases/opstreelabs.in_mongodbs.yaml
$ kubectl apply -f https://github.com/OT-CONTAINER-KIT/mongodb-operator/raw/main/config/crd/bases/opstreelabs.in_mongodbclusters.yaml
```

Once we have namespace in the place, we need to setup the RBAC related stuff like:- **ClusterRoleBindings**, **ClusterRole**, **Serviceaccount**.

```shell
$ kubectl apply -f https://raw.githubusercontent.com/OT-CONTAINER-KIT/mongodb-operator/main/config/rbac/service_account.yaml
$ kubectl apply -f https://raw.githubusercontent.com/OT-CONTAINER-KIT/mongodb-operator/main/config/rbac/role.yaml
$ kubectl apply -f https://github.com/OT-CONTAINER-KIT/mongodb-operator/blob/main/config/rbac/role_binding.yaml
```

As last part of the setup, now we can deploy the MongoDB Operator as deployment of Kubernetes.

```shell
$ kubectl apply -f https://github.com/OT-CONTAINER-KIT/mongodb-operator/raw/main/config/manager/manager.yaml
```
@@ -0,0 +1,7 @@
---
title: "Replication Setup"
weight: 4
linkTitle: "Replication Setup"
description: >
MongoDB database replication setup guide
---
7 changes: 7 additions & 0 deletions docs/content/en/docs/Getting Started/standalone-setup.md
@@ -0,0 +1,7 @@
---
title: "Standalone Setup"
weight: 3
linkTitle: "Standalone Setup"
description: >
MongoDB database standalone setup guide
---
6 changes: 3 additions & 3 deletions docs/content/en/docs/Overview/mongodb-setup.md
Expand Up @@ -11,20 +11,20 @@ MongoDB is a NoSQL document database system that scales well horizontally and im
- Cluster replicated mode
- Cluster sharded mode

## MongoDB Standalone Setup
## Standalone Setup

Just like any database mongodb also supports the standalone setup in which a single standalone instance is created and we setup MongoDB software on top of it. For small data chunks and development environment this setup can be ideal but in production grade environment this setup is not recommended because of the scalability and failover issues.

![](https://github.com/OT-CONTAINER-KIT/mongodb-operator/raw/docs-update/static/mongodb-standalone.png)

## MongoDB Replicated Setup
## Replicated Setup

A replica set in MongoDB is a group of mongod processes that maintain the same data set. Replica sets provide redundancy and high availability, and are the basis for all production deployments.
These Mongod processes usually run on different nodes(machines) which together form a Replica set cluster.

![](https://github.com/OT-CONTAINER-KIT/mongodb-operator/raw/docs-update/static/mongodb-replicated.png)

## MongoDB Sharded Setup
## Sharded Setup

Sharding is a method for distributing data across multiple machines. MongoDB uses sharding to support deployments with very large data sets and high throughput operations.

Expand Down

0 comments on commit 39badfa

Please sign in to comment.