Skip to content

Commit

Permalink
Modify misleading or outdated documentation (#1583)
Browse files Browse the repository at this point in the history
* Modify missleading or outdated documentation

* Fix indentation

* Removed redundant flag
  • Loading branch information
mateigrigore authored Jul 5, 2024
1 parent 3108a94 commit ec4a131
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
27 changes: 14 additions & 13 deletions docs/secure.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,21 @@ To secure connections to MongoDBCommunity resources with TLS using `cert-manager
helm repo update
```

1. Install `cert-manager`:
2. Install `cert-manager`:

```
helm install cert-manager jetstack/cert-manager --namespace cert-manager \
--create-namespace --set installCRDs=true
helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set crds.enabled=true
```

1. Create a TLS-secured MongoDBCommunity resource:
3. Create a TLS-secured MongoDBCommunity resource:

This assumes you already have the operator installed in namespace `<namespace>`

```
helm upgrade --install community-operator mongodb/community-operator \
--namespace mongodb --set resource.tls.useCertManager=true \
--namespace <namespace> --set resource.tls.useCertManager=true \
--set createResource=true --set resource.tls.enabled=true \
--set namespace=mongodb --create-namespace
--set namespace=<namespace>
```

This creates a resource secured with TLS and generates the necessary
Expand All @@ -72,21 +73,21 @@ To secure connections to MongoDBCommunity resources with TLS using `cert-manager

1. Test your connection over TLS by

- Connecting to a `mongod` container using `kubectl`:
- Connecting to a `mongod` container inside a pod using `kubectl`:

```
kubectl exec -it mongodb-replica-set -c mongod -- bash
kubectl exec -it <mongodb-replica-set-pod> -c mongod -- bash
```

Where `mongodb-replica-set` is the name of your MongoDBCommunity resource
Where `mongodb-replica-set-pod` is the name of a pod from your MongoDBCommunity resource

- Then, use `mongosh` to connect over TLS:
For how to get the connection string look at [Deploy A Replica Set](deploy-configure.md#deploy-a-replica-set)

```
mongosh --tls --tlsCAFile /var/lib/tls/ca/ca.crt --tlsCertificateKeyFile \
/var/lib/tls/server/*.pem \
--host <mongodb-replica-set>.<mongodb-replica-set>-svc.<namespace>.svc.cluster.local
mongosh "<connection-string>" --tls --tlsCAFile /var/lib/tls/ca/ca.crt --tlsCertificateKeyFile /var/lib/tls/server/*.pem
```

Where `mongodb-replica-set` is the name of your MongoDBCommunity
resource and `namespace` is the namespace of your deployment.
resource, `namespace` is the namespace of your deployment
and `connection-string` is a connection string for your `<mongodb-replica-set>-svc` service.
2 changes: 1 addition & 1 deletion docs/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ You cannot disable SCRAM authentication.

- To authenticate to your MongoDBCommunity resource, run the following command:
```
mongo "mongodb://<service-object-name>.<my-namespace>.svc.cluster.local:27017/?replicaSet=<replica-set-name>" --username <username> --password <password> --authenticationDatabase <authentication-database>
mongosh "mongodb://<replica-set-name>-svc.<my-namespace>.svc.cluster.local:27017/?replicaSet=<replica-set-name>" --username <username> --password <password> --authenticationDatabase <authentication-database>
```
- To change a user's password, create and apply a new secret resource definition with a `metadata.name` that is the same as the name specified in `passwordSecretRef.name` of the MongoDB CRD. The Operator will automatically regenerate credentials.

0 comments on commit ec4a131

Please sign in to comment.