MongoDB® is one of the most popular databases used by applications to store documents . It uses JSON-like documents with dynamic schemas in place of the tables in traditional relational databases.
In this document we will show you how to easily install it on an RKS cluster.
For a step-by-step guide, visit our guide on how to create a Kubernetes cluster.
Once you are successful, continue here:
Now that our cluster is ready and we have downloaded the kubeconfig file, let’s verify that our cluster is up and running. To verify that you have a running master and worker node, list the nodes by executing:
If everything works, you should something similar to this:
Now we are ready to deploy our application.
In this tutorial we use a helm chart from Bitnami. First, add the Bitnami helm repo.
Deploy MongoDB® using the helm chart with the name mongodb. The LoadBalancer parameter ensures that the service will be exposed and reachable from the Internet.
The resulting output will look like this:
At this stage you can check and see the service through kubectl:
In the Ridge console you will also be able to see the load balancer that forwards traffic to this service:
To remove this from the cluster at a later time use:
Accessing MongoDB® requires credentials. The database was created with a user. Retrieve the credentials with:
Use the following to retrieve the external IP:
Next, launch the shell.
The output will look like this:
Finally, list the dbs to verify that all is well.