Setup a MongoDB in less than 4 min on a free IBM Cloud Kubernetes cluster at a Hackathon

In this blog post I want to highlight that I just created a GitHub project and a 10 min YouTube video to “How to setup mongoDB in less than 4 min on a free IBM Cloud Kubernetes cluster at a Hackathon”.

My objective is to provide a small guide, how to setup a MongoDB server and Mongo UI (Mongo-Express)  on a free IBM Cloud Kubernetes cluster and when you don’t want to use the existing MongoDB service on IBM Cloud.

On the free IBM Cloud Kubernetes cluster:  No persistent volume claims are used. So, keep in mind, if your Pod in Kubernetes crashes the data of the database is lost.

Based on the “security feature” of the MongoDB default port 27017, you need to run the application to access the MongoDB server in the Kubernetes cluster .

In other words, your UI application has to access the database with a server application, which also runs on the free Kubernetes cluster (like the Mongo UI (Mongo-Express)  in that example here). You should implement a backend for frontend architecture.

The YouTube video shows the setup and a description how it works.

The gif shows what is automated deployed by a bash script and the yaml specification in the GitHub project, and in addition, how the Mongo UI (Mongo-Express)  access the MongoDB server from a browser.

  • Automated deployment:
    1. We have two container images in dockerhub mongo and mongo-express
    2. We create a Pod for the mongoDB server and pointing to the mongo image in dockerhub
    3. We create a Kubernetes service for the mongo-db Pod to use the DNS inside Kubernetes
    4. We create a Pod for the Mongo UI and pointing to the mongo-express image in dockerhub.
    5. We create a Kubernetes service for the mongo-ui Pod to use the DNS inside Kubernetes and make the service available from outside using the NodePort of the current WorkerNode.
  • Access the MongoDB using the Mongo UI (Mongo-Express)
    1. Open the browser and access the Mongo Express application with http://WorkerNodeIP:NodePort
    2. The mongo-ui Pod access the mongo-db server with the Kubernetes service name and MongoDB credentials.

     

mongodb ibmcloud container hackathon setup

Just visit the GitHub for the concrete steps to follow.

Note: Ensure you follow the MongoDB Licensing.


I hope this was useful for you and let’s see what’s next?

Greetings,

Thomas

PS:  You can try out Cloud Foundry Apps or Kubernetes on IBM Cloud. By the way, you can use the IBM Cloud for free, if you simply create an IBM Lite account. Here you only need an e-mail address.

#IBMDeveloper, #IBMCloud, #mongoDB, #mongoexpress #kubernetes , #container, #docker

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Up ↑

%d bloggers like this: