How to enable TLS

If the sharded MongoDB cluster has TLS enabled, mongos must also enable TLS. Enable it by integrating mongos with a TLS application:

juju integrate mongos <tls-application>
juju integrate mongos-k8s <tls-application>

<tls-application must be the same TLS application that the sharded MongoDB cluster is integrated to.

For more information about TLS in sharded clusters, see the Charmed MongoDB documentation for enabling security in sharded clusters.

Remove the connection

To remove a mongos connection to the sharded cluster, run:

juju remove-relation config-server mongos
juju remove-relation config-server mongos-k8s

Whenmongos is removed from the sharded cluster, the client is removed as well.

External connections (Kubernetes-only)

If you would like to connect the sharded MongoDB K8s cluster outside of Juju, this is possible with the configuration expose-external in the mongos-k8s charm.

Simply configure the charm to use nodeport:

juju config mongos-k8s expose-external=nodeport

This will make the mongos router accessible outside of Juju and will provide you access to the cluster. You will now see that all of your client URIs have been updated.

For example, if you run

juju run data-integrator get-credentials

You will see that the URI has changed.

To reconfigure the charm to have internal access only, run:

juju config mongos-k8s expose-external=none