With the rise of automation, everyone is shifting from monolithic architecture to microservice architecture. Microservice architectures are more flexible and robust when it comes to security, development and deployment cycles.

[Do check out our previous blog on Microservices to understand more about microservices]

For establishing a microservice architecture, one needs to automate the entire integration and deployment process. Continuous Integration and Continuous Deployment mechanisms are required while setting up the code structures.

 

An entire CICD flow looks like as follows:

Datalake on AWS
There are 3 steps in this cycle:

  1. Code Commit : In this phase, the developer pushes the code from the local system to a centralized storage space where other team members can do code review. Github, Bitbucket or AWS Code Commit can be used for this purpose
  2. Code Integration : In this phase, the fresh changes that the user has pushed into the code commit phase, are integrated with the existing code running on the server.This involves updating the docker file and pushing the code to deployment phase. There are multiple code integration tools available such as; Jenkins, CircleCI, Gitlab CI etc
  3. Code Deployment : This phase is responsible for updating the latest docker build inside the Kubernetes cluster. Various CD tools are; ArgoCD, Jenkins, Gitlab CD etc.

For one of our projects related to microservices, we automated the entire deployment process and created a CICD pipeline using Github, CircleCI and ArgoCD tools.

Next , I will take you through the steps followed for creating a CICD pipeline: (hopefully my experiences and learnings can help you in creating your first CICD pipeline1)

Let’s get started..

 

CircleCI

For configuring CircleCI, we need to create a CircleCI account and then link our github projects into CircleCI.
Steps involved in configuring CircleCI:

  • One can also sign-in to CircleCI using the github credentials, which will by default allow CircleCI to get access to all your github repositories.
  • Then you need to create a project inside CircleCI with necessary information about your github project code and all the environment variables(if any)
  • Next, you one needs to create a “.circleci” folder inside the project source code and create a “config.yaml” file inside it for defining the entire CircleCI process like limiting steps, running the integration steps then creating a build file and updating the docker build file.

Also, before moving to the Continuous Deployment phase, one needs to create a github repository, which will contain the deployment packages. These deployment packages are useful for deploying code to K8S(Kubernetes) machines.

The final step of the CircleCI process is responsible for updating the docker image version inside the deployment yaml files stored inside deploy repositories, so that the latest changes get deployed to our K8S.

 

ArgoCD

Once we pass the CircleCI process and have our latest docker image version inside the deployment yaml files in deploy repositories, we can start our deployment process.

Steps to configure and setup ArgoCD inside our K8S cluster are as follows:

  • Download argocd inside the K8S cluster using:
    https://argo-cd.readthedocs.io/en/stable/getting_started/
    This will set up argocd inside the k8s cluster.
  • Configure argocd inside the k8s, for this, apply ConfigMaps including the github repository settings.
  • Check fo argocd default password inside EKS only using the following command:
    kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath=”{.data.password}” | base64 -d; echo
    The default username is : admin
  • Login to the argocd console using : argocd login <ARGOCD_SERVER>
  • Create your first project inside the ArgoCD console using Create App, after defining all parameters like cluster namespace, repository name, sync settings etc.
  • Once the settings are completed, click on SUBMIT and the app will start getting created and you will be able to see your first app getting deployed to the K8S cluster

Easy, isnt it?

Once this flow is automated, you can save a lot of your time from solving unwanted merge conflicts or if in any case the developer has accidentally pushed a commit to PROD, ArgoCD will allow for an easy rollback.

I hope this blog has helped you understand the process of creating your CCID pipeline!

 

Smiley face

Chitrank Tyagi

Software Development Engineer



Chitrank is a tech enthusiast, who loves to code and is fond of playing with AWS services. He believes one should never be afraid of taking the first step as, that one step can be a difference in transforming you to a better version of yourself.