Skip to main content

Your submission was sent successfully! Close

Thank you for signing up for our newsletter!
In these regular emails you will find the latest updates from Canonical and upcoming events where you can meet our team.Close

Thank you for contacting us. A member of our team will be in touch shortly. Close

Charmed MongoDB K8s Tutorials > Deploy a replica set > 2. Deploy MongoDB

Deploy MongoDB

Deploying a Charmed MongoDB K8s replica set is a quite straightforward operation with Juju. In this page, you will learn how to deploy and track the charm’s status as Juju sets it up in the background.

Summary


Deploy a replica set

Deploy MongoDB with the following command:

juju deploy mongodb-k8s --trust

The --trust flag is necessary to grant the application access to the Kubernetes cluster

Juju will fetch the charm from Charmhub and begin deploying it to the MicroK8s cloud. This process can take several minutes depending on how provisioned (RAM, CPU, etc) your machine is.

Track deployment status

You can check the status of your deployment by running:

juju status --watch 1s --relations

This will display a table with an overview of all the status info of the elements in your juju model, like IP addresses, ports, state, and other useful data. The --watch 1s flag means that it will update every 1s.

For this tutorial, it is recommended to have a separate terminal permanently set to juju status --watch 1s --relations so that you can see what is happening every time you make changes to your juju model. The --relations flag will display additional information regarding integrations (previously known as “relations”), which will be useful later on.

When your MongoDB application is ready, juju status --watch 1s will show something similar to sample output below:

Model     Controller  Cloud/Region        Version  SLA          Timestamp
tutorial  overlord    microk8s/localhost  3.1.6   unsupported  15:33:40Z

App          Version  Status  Scale  Charm        Channel  Rev  Address        Exposed  Message
mongodb-k8s           active      1  mongodb-k8s  6/beta    37  10.152.183.20  no

Unit            Workload  Agent  Address      Ports  Message
mongodb-k8s/0*  active    idle   10.1.42.137
Model     Controller  Cloud/Region        Version  SLA          Timestamp
tutorial  overlord    microk8s/localhost  3.1.6   unsupported  15:33:41Z

To exit the screen with juju status --watch 1s, enter Ctrl + C.

Next step: 3. Access MongoDB

Last updated 2 months ago. Help improve this document in the forum.