| `extraVars` | Set environment variables for the main container | `{}` |
| `extraVars` | Set environment variables for the main container | `{}` |
| `extraLabels` | Additional labels to add to resources | `{}` |
*MongoDB config file*
*MongoDB config file*
All options that depended on the chart configuration are supplied as command-line arguments to `mongod`. By default,
All options that depended on the chart configuration are supplied as command-line arguments to `mongod`. By default, the chart creates an empty config file. Entries may be added via the `configmap` configuration value.
the chart creates an empty config file. Entries may be added via the `configmap` configuration value.
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
> **Tip**: You can use the default [values.yaml](values.yaml)
> **Tip**: You can use the default [values.yaml](values.yaml)
Once you have all 3 nodes in running, you can run the "test.sh" script in this directory, which will insert a key into
Once you have all 3 nodes in running, you can run the "test.sh" script in this directory, which will insert a key into the primary and check the secondaries for output. This script requires that the `$RELEASE_NAME` environment variable be set, in order to access the pods.
the primary and check the secondaries for output. This script requires that the `$RELEASE_NAME` environment variable
be set, in order to access the pods.
## Authentication
## Authentication
...
@@ -69,13 +100,19 @@ keys `user` and `password`, that for the key file must contain `key.txt`. The u
...
@@ -69,13 +100,19 @@ keys `user` and `password`, that for the key file must contain `key.txt`. The u
full `root` permissions but is restricted to the `admin` database for security purposes. It can be
full `root` permissions but is restricted to the `admin` database for security purposes. It can be
used to create additional users with more specific permissions.
used to create additional users with more specific permissions.
To connect to the mongo shell with authentication enabled, use a command similar to the following (substituting values as appropriate):
Enabling the metrics as follows will allow for each replicaset pod to export Prometheus compatible metrics
The default values for the liveness probe are:
on server status, individual replicaset information, replication oplogs, and storage engine.
```yaml
```yaml
livenessProbe:
metrics:
initialDelaySeconds: 30
enabled:true
timeoutSeconds: 5
image:
failureThreshold: 3
repository:ssalaues/mongodb-exporter
periodSeconds: 10
tag:0.6.1
successThreshold: 1
pullPolicy:IfNotPresent
port:9216
path:"/metrics"
socketTimeout:3s
syncTimeout:1m
prometheusServiceDiscovery:true
resources:{}
```
```
More information on [MongoDB Exporter](https://github.com/percona/mongodb_exporter) metrics available.
## Deep dive
## Deep dive
Because the pod names are dependent on the name chosen for it, the following examples use the
Because the pod names are dependent on the name chosen for it, the following examples use the
environment variable `RELEASENAME`. For example, if the helm release name is `messy-hydra`, one would need to set the
environment variable `RELEASENAME`. For example, if the helm release name is `messy-hydra`, one would need to set the following before proceeding. The example scripts below assume 3 pods only.
following before proceeding. The example scripts below assume 3 pods only.
@@ -218,6 +257,7 @@ connecting to: mongodb://127.0.0.1:27017
...
@@ -218,6 +257,7 @@ connecting to: mongodb://127.0.0.1:27017
```
```
Watch existing members:
Watch existing members:
```console
```console
$ kubectl run --attach bbox --image=mongo:3.6 --restart=Never --env="RELEASE_NAME=$RELEASE_NAME"-- sh -c'while true; do for i in 0 1 2; do echo $RELEASE_NAME-mongodb-replicaset-$i $(mongo --host=$RELEASE_NAME-mongodb-replicaset-$i.$RELEASE_NAME-mongodb-replicaset --eval="printjson(rs.isMaster())" | grep primary); sleep 1; done; done';
$ kubectl run --attach bbox --image=mongo:3.6 --restart=Never --env="RELEASE_NAME=$RELEASE_NAME"-- sh -c'while true; do for i in 0 1 2; do echo $RELEASE_NAME-mongodb-replicaset-$i $(mongo --host=$RELEASE_NAME-mongodb-replicaset-$i.$RELEASE_NAME-mongodb-replicaset --eval="printjson(rs.isMaster())" | grep primary); sleep 1; done; done';