Deploy Moleculer App on Kubernetes Using Helm

Mahmoud Almasri
Knawat Ninja
3 min readNov 9, 2021

--

This story is a part of the CI/CD process that we are using at Knawat to leverage the Advantages of Moleculer App on Kubernetes Using Helm to Support the Future of Work

Introduction

Are you going to deploy a Moleculer app (Microservices Node.js Framework) on a GKE cluster?

Deploying a microservice application to a Kubernetes cluster is not an easy process especially when your application grows up and your team became larger and you want to speed up your CI/CD process.

Let’s imagine you have a project consisting of 40 services, 5 developers working on it, 2 testers, each day you have 10 pull requests, and you need to make sure every PR is deployed on an isolated environment, tested, and merged at the end of the day!

In this story, we are going to deploy a Moleculerjs app just in one command with the helm package that we created.

https://artifacthub.io/packages/helm/moleculer/moleculer

Stack

Moleculer: Progressive microservices framework for Node.js.

Helm: Package manager for Kubernetes.

GKE: Google Kubernetes Engine, a managed Kubernetes service from Google Cloud.

Requirments

  • Helm: you can download from this link.
  • Google Cloud Project includes a Kubernetes Cluster, Ref.
  • Google Cloud CLI, you can find it here.

8 Steps To Successful Deployment Process

We created a simple app to demonstrate the process and use it in this story, you can find the full code on GitHub.

Also, for the moleculer helm package that we created, you can find the full code of this chart in this repo.

Below we’ll dive into each of the 8 steps:

1- Clone the project files to your computer, or start with your project.

2- Login to your Google Cloud account using the gcloud commad:

gcloud auth login

3- Connect to your GKE cluster

gcloud container clusters get-credentials [CLUSTER_NAME] — zone [CLUSTER_ZONE] — project [PROJECT_NAME]

4- Create an external static IP address

gcloud compute addresses create [IP_ADDRESS_NAME] --global --ip-version IPV4

5- Point your DNS to the IP address you have just created

  • * To get the IP address you have just created you can use this command
    gcloud compute addresses list --format json --filter [IP_ADDRESS_NAME] --format=”get(address)”

or, you can create a new DNS record in your hosted DNS zone in Google Cloud by the following command:

gcloud dns record-sets create [DNS]. --rrdatas=[IP_ADDRESS] --type=A — ttl=60 --zone=[YOUR_MANAGED_ZONE_NAME]

6- Add moleculer helm repo

helm repo add helm-charts https://knawat.github.io/helm-charts

7- Deploy your app using Moleculer Helm Package

8- Now, it’s done. You can call your service at https://[DNS]/api/products/list to test it.

In Conclusion,

You can now deploy your Moleculer App with one command using moleculer helm package instead of spending time creating your own Kubernetes configuration files.

For more details about our moleculer helm package, you can visit the repository, and in the next story, we are going to talk deeper about how we managed to create this helm package.

--

--