{{announcement.body}}
{{announcement.title}}

CI/CD with Cloud-Native Applications

DZone 's Guide to

CI/CD with Cloud-Native Applications

Creating a CI/CD pipeline is a necessary part of any cloud infrastructure, and tools like Jenkins, Travis CI, and CircleCI work well with Kubernetes.

· DevOps Zone ·
Free Resource

Continuous integration and continuous delivery, an approach now known as CI/CD, is more than just an approach for developing and delivering apps to customers. While CI/CD changes how apps are deployed—introducing smaller iterations and faster deployment in the process—the approach itself gets adopted differently. Especially for cloud-native applications.

When you implement CI/CD for deploying cloud-native applications, the approach becomes an inseparable tool that streamlines the whole development and deployment phases. In fact, cloud-native applications can be made more robust in the long run when their development integrates with pipelines based on the CI/CD approach.

Kubernetes as Container Orchestration Platform for Cloud-Native Applications

Compared to VM deployments, continuous delivery in an environment like Kubernetes is a lot more efficient. You don’t have to bring the entire application down to commit an update or make changes. Every microservice runs in a container and they are deliberately made modular. The characteristics of cloud-native applications actually amplify the benefits of CI/CD.

Cloud-native apps can be developed, tested, and delivered using the same (or similar) cloud environment with the help of Kubernetes. You can have containers in a node running a staging version of your app, and other containers in a separate node actually handling real users and keeping the application running.

What’s needed is a pipeline that bridges the gap between development stages. Developing a complete app with plenty of microservices is one thing; deploying the app to the cloud is another. The challenges associated with making the transition put further emphasis on the need for better pipelines for managing the process.

CD Pipeline with Jenkins

Jenkins is perhaps the most popular CD tool in the market. It is used by thousands of development teams to automate the process of orchestrating development, testing, and deployment pipelines for cloud-native applications. Since Kubernetes handles the orchestration of server resources, clusters, and nodes, Jenkins becomes the bridge needed to close the aforementioned gap.

Jenkins offers some key advantages.

  • Containers can be made more efficient from the beginning, and the entire app can perform better with its microservices and architecture defined as part of the development process.
  • Maintain a clean environment for maximum compatibility. Jenkins spools up new containers when testing and updates are needed.
  • Jenkins is also compatible with Helm and will run as a Kubernetes container, meaning you can run Jenkins with services like Amazon EKS and streamline your development pipeline even further.

Jenkins utilizes components such as Jenkins Master and Executor Pods, Data Persistent Disk, UI and Discovery Services, and UI Ingress as an added component. To set up Jenkins, you need a front-facing node for the UI and a private node or cluster for Jenkins Master Pods.

Since Jenkins runs as a standard Kubernetes pod, you configure the service using YAML files. Once the service is up, you can create Jenkins deployment from the master pod. Jenkins also uses persistent storage for storing configuration files.

As an added bonus, there is a native Kubernetes operator by VirtusLab for the CD tool and does exactly what it promises, “Jenkins operator is a Kubernetes native operator which fully manages Jenkins on Kubernetes. It was built with immutability and declarative configuration as code in mind.” The native operator lets Jenkins be as robust as other applications in the cluster by allowing for dynamic server resource provisioning.

Kubernetes & Travis CI

Travis CI may not be as popular as Jenkins, but that doesn’t mean it is less capable. A lot of avid developers stand by Travis as the tool to use when it comes to CI workflows. It is also worth noting that Travis CI doesn’t work natively with Kubernetes, but plugins and add-ons that make the two work seamlessly are widely available.

The process of deploying Travis CI is very similar to installing Jenkins. You add the Travis repo and configure travis.yml. Create pods for Travis and other supporting services (i.e. MySQL) and begin installing the services. You can choose to encrypt Travis at this point; the client tool of Travis supports encryption of secrets and credentials. 

Travis CI also works with other platforms and services. For instance, you can use Travis CI to automate deployment to AWS CodeDeploy. A simple travis setup command will trigger deployment as long as it is run in your project directory and a valid YML file is present. The tool will even offer the automatic creation of S3 storage buckets.

Travis CI automates testing as part of its features for cloud-native applications. Whenever you commit new changes to GitHub, Travis CI automatically runs tests on the new codes. If new updates break certain functions, you can catch the errors before moving forward to deployment. Travis also works well with different branches as well as multiple masters.

CircleCI as a Solution

The third tool we are going to cover in this article is CircleCI. This, too, is a tool that works really well with Kubernetes, especially since it comes with native docker support. You can replicate your development environment prior to deployment—and vice versa—within the K8s environment without having to manually configure everything.

A primary YML file stores orchestration configurations, but the real interaction between CircleCI and Kubernetes happens through Orbs. Orbs are smaller configuration packages that contain parameters of processes within CircleCI. When you want to automate testing, you can define reusable commands and routines using Orbs.

There is one huge advantage of Orbs in CircleCI, and that is the now-vast library of Orbs you can use to improve your CI/CD pipeline. There are so many things to automate in a development project, and being able to find routines, tools, and other components as Orbs is a huge plus. CircleCI also has Workflows (for runtimes and routines), Steps (for specific tasks and commands that you can combine into more complex routines), and Jobs.

The latter is how you define actions to complete.  Jobs and Steps let you balance between complexity and modularity. Keep in mind that CircleCI focuses on creating a CI/CD pipeline that can be utilized in different situations, so modularity and ease of use become important parts of the tool. As an added bonus, CircleCI lets you migrate from other CI/CD tools.

CI/CD with cloud-native applications is the way to go if you want to simplify development and deployment without allocating extensive resources. These tools all run in a standard Kubernetes container and can help simplify your deployment pipeline substantially.

Read more about CI/CD here: "Why Kubernetes Is Ideal for Your CI/CD Pipeline"

This post was originally published here.

Topics:
ci cd pipeline, circleci, cloud, cloud infrastructure, cloud native, cloud native applications, jenkins, kubernetes, travis ci

Published at DZone with permission of JP La Torre . See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}