Skip to content

Commit

Permalink
Added docs for configuration for standalone and replicated cluster (#28)
Browse files Browse the repository at this point in the history
Signed-off-by: iamabhishek-dubey <abhishekbhardwaj510@gmail.com>
  • Loading branch information
iamabhishek-dubey committed Feb 3, 2022
1 parent c4024d7 commit 6753290
Show file tree
Hide file tree
Showing 6 changed files with 210 additions and 6 deletions.
7 changes: 7 additions & 0 deletions docs/content/en/docs/Configuration/_index.md
@@ -0,0 +1,7 @@
---
title: "Configuration"
linkTitle: "Configuration"
weight: 3
description: >
Configuration Options for Helm Chart and CRD parameters
---
103 changes: 103 additions & 0 deletions docs/content/en/docs/Configuration/mongo-replicated-cluster.md
@@ -0,0 +1,103 @@
---
title: "MongoDB Replicated Cluster"
weight: 3
linkTitle: "MongoDB Replicated Cluster"
description: >
MongoDB replicated cluster configuration for CRD and helm chart
---

MongoDB cluster configuration is easily customizable using `helm` as well `kubectl`. Since all the configurations are in the form YAML file, it can be easily changed and customized.

The `values.yaml` file for MongoDB cluster setup can be found [here](https://github.com/OT-CONTAINER-KIT/helm-charts/tree/main/charts/mongodb-cluster). But if the setup is not done using `Helm`, in that case Kubernetes manifests needs to be customized.

## Parameters for Helm Chart

| **Name** | **Value** | **Description** |
|-------------------------------------------|:------------------------:|---------------------------------------------------|
| `clusterSize` | 3 | Size of the MongoDB cluster |
| `image.name` | quay.io/opstree/mongo | Name of the MongoDB image |
| `image.tag` | v5.0 | Tag for the MongoDB image |
| `image.imagePullPolicy` | IfNotPresent | Image Pull Policy of the MongoDB |
| `resources` | {} | Request and limits for MongoDB statefulset |
| `storage.enabled` | true | Storage is enabled for MongoDB or not |
| `storage.accessModes` | ["ReadWriteOnce"] | AccessMode for storage provider |
| `storage.storageSize` | 1Gi | Size of storage for MongoDB |
| `storage.storageClass` | gp2 | Name of the storageClass to create storage |
| `mongoDBMonitoring.enabled` | true | MongoDB exporter should be deployed or not |
| `mongoDBMonitoring.image.name` | bitnami/mongodb-exporter | Name of the MongoDB exporter image |
| `mongoDBMonitoring.image.tag` | 0.11.2-debian-10-r382 | Tag of the MongoDB exporter image |
| `mongoDBMonitoring.image.imagePullPolicy` | IfNotPresent | Image Pull Policy of the MongoDB exporter image |
| `serviceMonitor.enabled` | false | Servicemonitor to monitor MongoDB with Prometheus |
| `serviceMonitor.interval` | 30s | Interval at which metrics should be scraped. |
| `serviceMonitor.scrapeTimeout` | 10s | Timeout after which the scrape is ended |
| `serviceMonitor.namespace` | monitoring | Namespace in which Prometheus operator is running |

## Parameters for CRD Object Definition

These are the parameters that are currently supported by the MongoDB operator for the cluster MongoDB database setup:-

- clusterSize
- kubernetesConfig
- storage
- mongoDBSecurity
- mongoDBMonitoring

### clusterSize

`clusterSize` is the size of MongoDB replicated cluster. We have to provide the number of node count that we want to make part of MongoDB cluster. For example:- 1 primary and 2 secondary is 3 as pod count.

```yaml
clusterSize: 3
```

### kubernetesConfig

`kubernetesConfig` is the general configuration paramater for MongoDB CRD in which we are defining the Kubernetes related configuration details like- image, tag, imagePullPolicy, and resources.

```yaml
kubernetesConfig:
image: quay.io/opstree/mongo:v5.0
imagePullPolicy: IfNotPresent
resources:
requests:
cpu: 1
memory: 8Gi
limits:
cpu: 1
memory: 8Gi
```

### storage

`storage` is the storage specific configuration for MongoDB CRD. With this parameter we can make enable persistence inside the MongoDB statefulset. In this parameter, we will provide inputs like- accessModes, size of the storage, and storageClass.

```yaml
storage:
accessModes: ["ReadWriteOnce"]
storageSize: 1Gi
storageClass: csi-cephfs-sc
```

### mongoDBSecurity

`mongoDBSecurity` is the security specification for MongoDB CRD. If we want to enable our MongoDB database authenticated, in that case, we can enable this configuration. To enable the authentication we need to provide paramaters like- admin username, secret reference in Kubernetes.

```yaml
mongoDBSecurity:
mongoDBAdminUser: admin
secretRef:
name: mongodb-secret
key: password
```

### mongoDBMonitoring

`mongoDBMonitoring` is the monitoring feature for MongoDB CRD. By using this parameter we can enable the MongoDB monitoring using **[MongoDB Exporter](https://github.com/percona/mongodb_exporter)**. In this parameter, we need to provide image, imagePullPolicy and resources for mongodb exporter.

```yaml
mongoDBMonitoring:
enableExporter: true
image: bitnami/mongodb-exporter:0.11.2-debian-10-r382
imagePullPolicy: IfNotPresent
resources: {}
```
94 changes: 94 additions & 0 deletions docs/content/en/docs/Configuration/mongo-standalone.md
@@ -0,0 +1,94 @@
---
title: "MongoDB Standalone"
weight: 2
linkTitle: "MongoDB Standalone"
description: >
MongoDB standalone configuration for CRD and helm chart
---

MongoDB standalone configuration is easily customizable using `helm` as well `kubectl`. Since all the configurations are in the form YAML file, it can be easily changed and customized.

The `values.yaml` file for MongoDB standalone setup can be found [here](https://github.com/OT-CONTAINER-KIT/helm-charts/tree/main/charts/mongodb). But if the setup is not done using `Helm`, in that case Kubernetes manifests needs to be customized.

## Parameters for Helm Chart

| **Name** | **Value** | **Description** |
|---------------------------------------------|:------------------------:|----------------------------------------------------|
| `image.name` | quay.io/opstree/mongo | Name of the MongoDB image |
| `image.tag` | v5.0 | Tag for the MongoDB image |
| `image.imagePullPolicy` | IfNotPresent | Image Pull Policy of the MongoDB |
| `resources` | {} | Request and limits for MongoDB statefulset |
| `storage.enabled` | true | Storage is enabled for MongoDB or not |
| `storage.accessModes` | ["ReadWriteOnce"] | AccessMode for storage provider |
| `storage.storageSize` | 1Gi | Size of storage for MongoDB |
| `storage.storageClass` | gp2 | Name of the storageClass to create storage |
| `mongoDBMonitoring.enabled` | true | MongoDB exporter should be deployed or not |
| `mongoDBMonitoring.image.name` | bitnami/mongodb-exporter | Name of the MongoDB exporter image |
| `mongoDBMonitoring.image.tag` | 0.11.2-debian-10-r382 | Tag of the MongoDB exporter image |
| `mongoDBMonitoring.image.imagePullPolicy` | IfNotPresent | Image Pull Policy of the MongoDB exporter image |
| `serviceMonitor.enabled` | false | Servicemonitor to monitor MongoDB with Prometheus |
| `serviceMonitor.interval` | 30s | Interval at which metrics should be scraped. |
| `serviceMonitor.scrapeTimeout` | 10s | Timeout after which the scrape is ended |
| `serviceMonitor.namespace` | monitoring | Namespace in which Prometheus operator is running |


## Parameters for CRD Object Definition

These are the parameters that are currently supported by the MongoDB operator for the standalone MongoDB database setup:-

- kubernetesConfig
- storage
- mongoDBSecurity
- mongoDBMonitoring

### kubernetesConfig

`kubernetesConfig` is the general configuration paramater for MongoDB CRD in which we are defining the Kubernetes related configuration details like- image, tag, imagePullPolicy, and resources.

```yaml
kubernetesConfig:
image: quay.io/opstree/mongo:v5.0
imagePullPolicy: IfNotPresent
resources:
requests:
cpu: 1
memory: 8Gi
limits:
cpu: 1
memory: 8Gi
```

### storage

`storage` is the storage specific configuration for MongoDB CRD. With this parameter we can make enable persistence inside the MongoDB statefulset. In this parameter, we will provide inputs like- accessModes, size of the storage, and storageClass.

```yaml
storage:
accessModes: ["ReadWriteOnce"]
storageSize: 1Gi
storageClass: csi-cephfs-sc
```

### mongoDBSecurity

`mongoDBSecurity` is the security specification for MongoDB CRD. If we want to enable our MongoDB database authenticated, in that case, we can enable this configuration. To enable the authentication we need to provide paramaters like- admin username, secret reference in Kubernetes.

```yaml
mongoDBSecurity:
mongoDBAdminUser: admin
secretRef:
name: mongodb-secret
key: password
```

### mongoDBMonitoring

`mongoDBMonitoring` is the monitoring feature for MongoDB CRD. By using this parameter we can enable the MongoDB monitoring using **[MongoDB Exporter](https://github.com/percona/mongodb_exporter)**. In this parameter, we need to provide image, imagePullPolicy and resources for mongodb exporter.

```yaml
mongoDBMonitoring:
enableExporter: true
image: bitnami/mongodb-exporter:0.11.2-debian-10-r382
imagePullPolicy: IfNotPresent
resources: {}
```
4 changes: 2 additions & 2 deletions docs/content/en/docs/Getting Started/installation.md
Expand Up @@ -19,7 +19,7 @@ Setup of MongoDB operator can be easily done by using simple [helm](https://helm

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

## Helm Installation
## Operator Setup by Helm

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

Expand Down Expand Up @@ -70,7 +70,7 @@ NAME READY STATUS RESTARTS AGE
mongodb-operator-fc88b45b5-8rmtj 1/1 Running 0 21d
```

## Kubectl Installation
## Operator Setup by Kubectl

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

Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/docs/Overview/mongodb-overview.md
Expand Up @@ -25,5 +25,5 @@ A document can contain a number of fields (value), regarding the details of the
## MongoDB Database

<div align="center">
<img src="https://github.com/OT-CONTAINER-KIT/mongodb-operator/raw/docs-update/static/mongo-db.drawio.png">
<img src="https://github.com/OT-CONTAINER-KIT/mongodb-operator/raw/main/static/mongo-db.drawio.png">
</div>
6 changes: 3 additions & 3 deletions docs/content/en/docs/Overview/mongodb-setup.md
Expand Up @@ -15,14 +15,14 @@ MongoDB is a NoSQL document database system that scales well horizontally and im

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)
![](https://github.com/OT-CONTAINER-KIT/mongodb-operator/raw/main/static/mongodb-standalone.png)

## 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)
![](https://github.com/OT-CONTAINER-KIT/mongodb-operator/raw/main/static/mongodb-replicated.png)

## Sharded Setup

Expand All @@ -32,4 +32,4 @@ Sharding is a method for distributing data across multiple machines. MongoDB use
- Mongos: The mongos acts as a query router, providing an interface between client applications and the sharded cluster.
- Config Servers: Config servers store metadata and configuration settings for the cluster. They are also deployed as a replica set.

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

0 comments on commit 6753290

Please sign in to comment.