Increase your Development Velocity with Nirmata and CircleCI

Increase your Development Velocity with Nirmata and CircleCI

Did you know you can use Nirmata to deploy your Kubernetes applications as part of your CI/CD process? The Nirmata CircleCI Orb can deploy your applications to Nirmata-managed Kubernetes clusters. This blog post explains what you need to take your CI/CD pipeline to the next level.

Building a Cloud native DevOps pipeline means automating build, test, and deployment of highly available microservices.

Nirmata exists to eliminate friction with the enterprise adoption of open source and cloud-native technologies. It’s all about development velocity!  Enterprise developers want to automate and streamline their CI/CD pipelines to speed up their development. CircleCI provides a platform to automate the development process quickly at scale.  Its integration plugin, called Orbs, allows vendors and end users to rapidly automate deployment and testing.

In this post, I will show you how Nirmata simplifies the use of CircleCI to deploy existing and new Kubernetes applications. What’s great is this process does not impose any additional complexities to your workflow.  

Use Case

Below we will implement a simple build pipeline where we build our software, deploy a Kubernetes app, test it, and delete the app.

Implementation Details

What you need:

1)An existing application in a git repo that is already being packaged as a docker image

2) A CircleCI account/installation

3) A Nirmata account/installation.

The current Nirmata orb can be found here which details additional commands.

https://circleci.com/orbs/registry/orb/nirmata/nirmata

 

Steps

  1. Add an API Key to the Project to securely access Nirmata

In your project config set NIRMATA_API_KEY.  Use an API key from a user with a DevOps role for the project. Be sure this is an account with a DevOps role, not an admin or platform role.

 

Nirmata (Settings -> Users)

CircleCI (Project Settings -> Environment Variables)  add NIRMATA_API_KEY

  1. Add a yaml file your source code repo defining the Kubernetes Deployment/Pod/etc you need to test.

 

You can export this yaml from an existing application in your catalog via the gear icon on an application’s page. (Catalog -> {Application} -> Gear Icon)  Remember you can combine Deployment/Pod and Service yaml file in one file. Use “—” to separate the Deployment/Pod and Service in the yaml file.

  1. Configure your CircleCI configuration files.

 

You will need to edit your CircleCI configuration file .circleci/config.yml This will add the Nirmata orb and define the variables to connect to the correct resources.

 

Initial config.yml:

version: 2.1
jobs:
  build:
    docker:
      - image: debian:stable
    steps:
      - checkout
      - run:
          name: Apt-get update
          command: apt-get update
      - run:
          name: Apt-get install build and test requirements
          command: apt-get install -y ant      
      - run:
          name: Build WAR File
          command: ant
      - run:
          name: Package App to Docker
          command: docker build . -t myapp:$buildtag

 

Add the Nirmata orb and app deployment steps.

Modified config.yml:

version: 2.1
orbs:
 nirmata: nirmata/nirmata@1.1 
jobs:
  build:
    docker:
      - image: debian:stable
    steps:
      - checkout
      - run:
          name: Apt-get update
          command: apt-get update
      - run:
          name: apt-get install build and test requirements
          command: apt-get install -y ant curl jq 
      - run:
          name: Build
          command: ant
      - run:
          name: Package App to Docker
          command: docker build . -t myapp:$buildtag
      - run:
          name: Upload Docker Image
          command: docker tag $buildtag myrepo/myapp && docker push  myrepo/myapp
      - nirmata/add_command: 
          app_name: "myapp-$buildtag"
          yaml_file: "myapp.yml"
          nirmata_server: "mynirmata.example.com"
       - nirmata/deploy_command: 
          app_name: "myapp-$buildtag"
          nirmata_server: "mynirmata.example.com"
          env_id: "1234568-abcde"
          env_name: "qa"
      - run:
          name: QA tests
          command: ./qa-test.sh myapp-$buildtag
      - nirmata/delete_catalog_command: 
          app_name: "myapp-$buildtag"
          nirmata_server: "mynirmata.example.com"
      - nirmata/delete_deployed_command: 
          app_name: "myapp-$buildtag"
          nirmata_server: "mynirmata.example.com"

 

As you can see, this simple process allows you to rapidly deploy Kubernetes applications for testing and production. Once you’ve successfully configured the orb, every time your team makes a configuration change to your git repo, CircleCI will build your app and then deploy it into your Kubernetes cluster for testing.

 

 

 

GitOps Workflow using Kubernetes & Nirmata
Kubernetes Jobs and CronJobs
No Comments

Sorry, the comment form is closed at this time.