Skip to content

Commit facc90e

Browse files
[Docs][Add] Added docs for v0.1.0 (#29)
* Added documentation for v0.1.0 Signed-off-by: iamabhishek-dubey <abhishekbhardwaj510@gmail.com>
1 parent 6753290 commit facc90e

File tree

10 files changed

+206
-0
lines changed

10 files changed

+206
-0
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
# Ignore build and test binaries.
33
bin/
44
testbin/
5+
docs/
6+
examples/

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ testbin/*
2323
*.swp
2424
*.swo
2525
*~
26+
.hugo_build.lock

CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
### v0.1.0
2+
##### Feburary 5, 2022
3+
4+
#### :tada: Features
5+
6+
- Added standalone MongoDB functionality
7+
- Added cluster MongoDB functionality
8+
- Helm chart installation support
9+
- Monitoring support for MongoDB
10+
- Documentation for setup and management
11+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: "Development"
3+
linkTitle: "Development"
4+
weight: 5
5+
description: >
6+
Development related information for MongoDB Operator
7+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: "Development Guide"
3+
weight: 2
4+
linkTitle: "Development Guide"
5+
description: >
6+
Development guide for MongoDB Operator
7+
---
8+
9+
## Pre-requisites
10+
11+
**Access to Kubernetes cluster**
12+
13+
First, you will need access to a Kubernetes cluster. The easiest way to start is minikube.
14+
15+
- [Virtualbox](https://www.virtualbox.org/wiki/Downloads)
16+
- [Minikube](https://kubernetes.io/docs/setup/minikube/)
17+
- [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
18+
19+
**Tools to build an Operator**
20+
21+
Apart from kubernetes cluster, there are some tools which are needed to build and test the MongoDB Operator.
22+
23+
- [Git](https://git-scm.com/downloads)
24+
- [Go](https://golang.org/dl/)
25+
- [Docker](https://docs.docker.com/install/)
26+
- [Operator SDK](https://github.com/operator-framework/operator-sdk/blob/v0.8.1/doc/user/install-operator-sdk.md)
27+
- [Make](https://www.gnu.org/software/make/manual/make.html)
28+
29+
## Building Operator
30+
31+
To build the operator on local system, we can use `make` command.
32+
33+
```shell
34+
$ make manager
35+
...
36+
go build -o bin/manager main.go
37+
```
38+
39+
MongoDB operator gets packaged as a container image for running on the Kubernetes cluster.
40+
41+
```shell
42+
$ make docker-build
43+
```
44+
45+
If you want to play it on Kubernetes. You can use a minikube.
46+
47+
```shell
48+
$ minikube start --vm-driver virtualbox
49+
...
50+
😄 minikube v1.0.1 on linux (amd64)
51+
🤹 Downloading Kubernetes v1.14.1 images in the background ...
52+
🔥 Creating kvm2 VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
53+
📶 "minikube" IP address is 192.168.39.240
54+
🐳 Configuring Docker as the container runtime ...
55+
🐳 Version of container runtime is 18.06.3-ce
56+
⌛ Waiting for image downloads to complete ...
57+
✨ Preparing Kubernetes environment ...
58+
🚜 Pulling images required by Kubernetes v1.14.1 ...
59+
🚀 Launching Kubernetes v1.14.1 using kubeadm ...
60+
⌛ Waiting for pods: apiserver proxy etcd scheduler controller dns
61+
🔑 Configuring cluster permissions ...
62+
🤔 Verifying component health .....
63+
💗 kubectl is now configured to use "minikube"
64+
🏄 Done! Thank you for using minikube!
65+
```
66+
67+
```shell
68+
$ make test
69+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: "Monitoring"
3+
linkTitle: "Monitoring"
4+
weight: 4
5+
description: >
6+
Monitoring of MongoDB standalone and cluster
7+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: "Grafana Dashboard"
3+
weight: 3
4+
linkTitle: "Grafana Dashboard"
5+
description: >
6+
Monitoring dashboard of MongoDB database for Grafana
7+
---
8+
9+
### Coming Soon
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
title: "Prometheus Monitoring"
3+
weight: 2
4+
linkTitle: "Prometheus Monitoring"
5+
description: >
6+
Monitoring of MongoDB standalone and replicaset cluster using Prometheus
7+
---
8+
9+
In MongoDB Operator, we are using [mongodb-exporter](https://github.com/percona/mongodb_exporter) to collect the stats, metrics for MongoDB database. This exporter is capable to capture the stats for standalone and cluster mode of MongoDB.
10+
11+
If we are using the `helm` chart for installation purpose, we can simply enable this configuration inside the [values.yaml](https://github.com/OT-CONTAINER-KIT/helm-charts/blob/main/charts/mongodb-cluster/values.yaml).
12+
13+
```yaml
14+
mongoDBMonitoring:
15+
enabled: true
16+
image:
17+
name: bitnami/mongodb-exporter
18+
tag: 0.11.2-debian-10-r382
19+
imagePullPolicy: IfNotPresent
20+
resources: {}
21+
```
22+
23+
In case of `kubectl` installation, we can add a code snippet in yaml manifest like this:-
24+
25+
```yaml
26+
mongoDBMonitoring:
27+
enableExporter: true
28+
image: bitnami/mongodb-exporter:0.11.2-debian-10-r382
29+
imagePullPolicy: IfNotPresent
30+
resources: {}
31+
```
32+
33+
## ServiceMonitor for Prometheus Operator
34+
35+
Once the exporter is configured, the next aligned task would be to ask [Prometheus](https://prometheus.io) to monitor it. For [Prometheus Operator](https://github.com/prometheus-operator/prometheus-operator), we have to create CRD object in Kubernetes called "ServiceMonitor". We can update this using the `helm` as well.
36+
37+
```yaml
38+
serviceMonitor:
39+
enabled: false
40+
interval: 30s
41+
scrapeTimeout: 10s
42+
namespace: monitoring
43+
```
44+
45+
For kubectl related configuration, we may have to create `ServiceMonitor` definition in a yaml file and apply it using kubectl command. A `ServiceMonitor` definition looks like this:-
46+
47+
```yaml
48+
---
49+
apiVersion: monitoring.coreos.com/v1
50+
kind: ServiceMonitor
51+
metadata:
52+
name: mongodb-prometheus-monitoring
53+
labels:
54+
app.kubernetes.io/name: mongodb
55+
app.kubernetes.io/managed-by: mongodb
56+
app.kubernetes.io/instance: mongodb
57+
app.kubernetes.io/version: v0.1.0
58+
app.kubernetes.io/component: middleware
59+
spec:
60+
selector:
61+
matchLabels:
62+
app: mongodb
63+
mongodb_setup: standalone
64+
role: standalone
65+
endpoints:
66+
- port: metrics
67+
interval: 30s
68+
scrapeTimeout: 30s
69+
namespaceSelector:
70+
matchNames:
71+
- middleware-production
72+
```
73+
74+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: "Release History"
3+
linkTitle: "Release History"
4+
weight: 6
5+
description: >
6+
Release information for MongoDB Operator
7+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: "CHANGELOG"
3+
weight: 2
4+
linkTitle: "CHANGELOG"
5+
description: >
6+
Changelog version history for MongoDB
7+
---
8+
9+
### v0.1.0
10+
11+
**Feburary 5, 2022**
12+
13+
**🏄 Features**
14+
15+
- Added standalone MongoDB functionality
16+
- Added cluster MongoDB functionality
17+
- Helm chart installation support
18+
- Monitoring support for MongoDB
19+
- Documentation for setup and management

0 commit comments

Comments
 (0)