Skip to content

Walk through deployment in Kubernetes cluster with Helm

Tianyi Zhang edited this page Nov 26, 2019 · 3 revisions

Here I will provide a step-by-step walkthrough to get the whole application deployed into Kubernetes cluster. Following the steps should get you a running application which is accessible across the Internet. I am using GKE(Goole Kubernetes Engine) as an example, you are free to choose from any cloud provider.

  1. Set up MongoDB Databse I recommend you to use cloud hosted MongoDb service for ease of management. Here I will use MongoDB Atlas whose free tier should be sufficient for most use case. You are free to choose other providers.

Head to https://www.mongodb.com/cloud/atlas register your account and create a free cluster. For better security, you should setup Database Access and Network Access to prevent everyone from reading your database. Check out documentation for Atlas for details. Once you have a running db cluster, connect-> connect your application -> Node.Js Driver / version 3.0 later will give you the connection string you need to for the application configuration. The connection string should look like mongodb+srv://<username>:<password>@......

  1. Set up RabbitMQ message queue

Message queue is used in the application to handle background tasks related to each application. Specifically, RabbitMQ is used. Cloud AMQP provides free cloud solution https://www.cloudamqp.com/. Same thing here feel free to use other provider if you like. Create a free service instance there and in the instance detail you will see a AMQP URL field. That will be used in our app config later on.

  1. Setup SMTP email sending service credentials

You could use service like MailGun. Note: For most service providers, you need to have credit card verified in order to send emails to everyone. Check out the service you wish to use for pricing details.

  1. Register for a Google Cloud account and create a project Until now, you have every external services setup. Just follow the following steps to get the application stack deployed:

You need to setup a Google Cloud account and create a project which will be used to deploy the application. Google Cloud have very detailed tutorial articles which you could follow easily. Note: some service in google cloud will incur some change however new user will get certain amount of free credits to use.

Head to Kubernetes Engine -> create a cluster. Could start with one node g1-small to minimize cost. You could choose to use google cloud shell or install locally kubectl to interact with your cluster.

  1. Install Helm on your cluster and your workstation Helm is use to easily package and deploy the whole stack of components into Kubernete cluster easily. Once you configure your kubectl to points to your newly created cluster, you need to install helm on it. See https://helm.sh/docs/intro/quickstart/ for instructions.

  2. Ready to depoly

Before deploy, make sure you change the configurations inside the chart directory for both backend and frontend. You should see comments describing each available configuration options. Make sure you fill in the correct config value that you prepared in above steps.

From the mac-whitelist directory, issue a helm install --name <> . command to deploy the application. For the container image, you could use the public image I provided there. Change the tag to 1.0.0 for stable release unless you want to build your own.

Once complete, you could use kubectl or go to the GKE console to see the ingress resource where you will see a public available ip address for the client application. Go to the link and you will see the application running there. It will take around 10 minutes for the ingress to setup.

Note: Be sure to check out the templates in the chart and especially the values.yaml files. The value files contains all configuration details in order to run the application properly. You need to change those values to your own configured values. You might need to change the chart templates a little bit depending on different cloud providers or if you want to configure https.

Clone this wiki locally