Blog

Continuous delivery using Jenkins DSL, KMS, ECS, Cloudformation and Kubernetes

Dec 8, 2016 | Announcements, Migration, MSP

We build deployment pipelines and continuous delivery for organizations that want to increase their productivity. Here are some of the challenges that our clients commonly face:

  • Building Jenkins and installing plugins itself normally isn’t infrastructure as code
  • We always need solution for encrypting secrets for Jenkins
  • Some time build fails due to resource constraints

With the release of ecs-refarch-cloudformation, AWS created a blueprint to run micro services on ECS using Cloud-formation. It uses YAML format to manage cloud formation—much better than dealing with JSON.
We extended the same blueprint and added Jenkins master and slave. Master is also running on ECS. Slaves are auto scaling, and ALB is in front of it.

Why run Jenkins in ECS?
  1. You can Scale up and down based on the build load
  2. You’ll be able to Build Jenkins just like any other service. Official Jenkins image has built in support to install plugins
  3. Jenkins Jobs are part of the container. Official Jenkins image also makes it as to add seed jobs to as part of the run time.
  4. No additional effort required to get centralized logging for Jenkins build , logs are easily be shipped to
    CloudWatch
Architecture:

Jenkins in Kubernetes

If you’re not that much into ECS and would like a different approach you can deploy the same jenkins image we built Here in a Kubernetes cluster. Follow the instructions in the repository’s Readme to build and push the image.

Just like in ECS we configured the kubernetes cluster to scale in or out based on the load its receiving, in this case we are using overall memory utilization of the auto scaling group. The jenkinsci/kubernetes-plugin can be used to run dynamic jenkins slaves inside the kubernetes cluster, so it’s just a matter of refactoring the jobs to run on those slaves and the auto scaling group will add more instances to the cluster when necessary.

Why run Jenkins in Kubernetes
  1. You can scale the number of nodes in the cluster based on the load jenkins receives.
  2. You can build your own custom version of Jenkins as a Helm chart and easily deploy it to the cluster
  3. You can pull your jenkins images from a public or private repository using Helm. Further instructions for that can be found in our repository.
Architecture:

Jenkins pipeline output:

How to get started:

Here is the link to the code repo. Follow the Readme and comment if there are any issues.

We would like to know if you have similar setup or you have questions regarding this setup. Pull requests are welcomed 😃

nClouds Insights

Join thousands of DevOps and cloud professionals. Sign up for our newsletter for updated informaion and insights

nClouds
nClouds is a cloud-native services company that helps organizations maximize site uptime, performance, stability, and support, bringing out the best of their people and technology using AWS