Book Image

Modern DevOps Practices - Second Edition

By : Gaurav Agarwal
Book Image

Modern DevOps Practices - Second Edition

By: Gaurav Agarwal

Overview of this book

DevOps and the cloud have changed how we look at software development and operations like never before, leading to the rapid growth of various DevOps tools, techniques, and practices. This updated edition helps you pick up the right tools by providing you with everything you need to get started with your DevOps journey. The book begins by introducing you to modern cloud-native architecture, and then teaches you about the architectural concepts needed to implement the modern way of application development. The next set of chapters helps you get familiarized with Git, Docker, Kubernetes, Ansible, Terraform, Packer, and other similar tools to enable you to build a base. As you advance, you’ll explore the core elements of cloud integration—AWS ECS, GKE, and other CaaS services. The chapters also discuss GitOps, continuous integration, and continuous delivery—GitHub actions, Jenkins, and Argo CD—to help you understand the essence of modern app delivery. Later, you’ll operate your container app in production using a service mesh and apply AI in DevOps. Throughout the book, you’ll discover best practices for automating and managing your development lifecycle, infrastructure, containers, and more. By the end of this DevOps book, you'll be well-equipped to develop and operate applications using modern tools and techniques.
Table of Contents (24 chapters)
1
Part 1:Modern DevOps Fundamentals
6
Part 2:Container Orchestration and Serverless
10
Part 3:Managing Config and Infrastructure
14
Part 4:Delivering Applications with GitOps
18
Part 5:Operating Applications in Production

Containers and modern DevOps practices

Containers and modern DevOps practices are highly complementary and have transformed how we approach software development and deployment.

Containers have a great synergy with modern DevOps practices as they provide the necessary infrastructure encapsulation, portability, scalability, and agility to enable rapid and efficient software delivery. With modern DevOps practices such as CI/CD, IaC, and microservices, containers form a powerful foundation for organizations to achieve faster time-to-market, improved software quality, and enhanced operational efficiency.

Containers follow DevOps practices right from the start. If you look at a typical container build and deployment workflow, this is what you’ll get:

  1. First, code your app in whatever language you wish.
  2. Then, create a Dockerfile that contains a series of steps to install the application dependencies and environment configuration to run your app.
  3. Next, use the Dockerfile to create container images by doing the following:

a) Build the container image.

b) Run the container image.

c) Unit test the app running on the container.

  1. Then, push the image to a container registry such as DockerHub.
  2. Finally, create containers from container images and run them in a cluster.

You can embed these steps beautifully in the CI/CD pipeline example shown here:

Figure 1.7 – Container CI/CD pipeline example

Figure 1.7 – Container CI/CD pipeline example

This means your application and its runtime dependencies are all defined in the code. You follow configuration management from the very beginning, allowing developers to treat containers like ephemeral workloads (ephemeral workloads are temporary workloads that are dispensable, and if one disappears, you can spin up another one without it having any functional impact). You can replace them if they misbehave – something that was not very elegant with virtual machines.

Containers fit very well within modern CI/CD practices as you now have a standard way of building and deploying applications, irrespective of the language you code in. You don’t have to manage expensive build and deployment software as you get everything out of the box with containers.

Containers rarely run on their own, and it is a standard practice in the industry to plug them into a container orchestrator such as Kubernetes or use a Container-as-a-Service (CaaS) platform such as AWS ECS and EKS, Google Cloud Run and Kubernetes Engine, Azure ACS and AKS, Oracle OCI and OKE, and others. Popular Function-as-a-Service (FaaS) platforms such as AWS Lambda, Google Functions, Azure Functions, and Oracle Functions also run containers in the background. So, though they may have abstracted the underlying mechanism from you, you may already be using containers unknowingly.

As containers are lightweight, you can build smaller parts of applications into containers to manage them independently. Combine that with a container orchestrator such as Kubernetes, and you get a distributed microservices architecture running with ease. These smaller parts can then scale, auto-heal, and get released independently of others, which means you can release them into production quicker than before and much more reliably.

You can also plug in a service mesh (infrastructure components that allow you to discover, list, manage, and allow communication between multiple components (services) of your microservices application) such as Istio on top, and you will get advanced Ops features such as traffic management, security, and observability with ease. You can then do cool stuff such as blue/green deployments and A/B testing, operational tests in production with traffic mirroring, geolocation-based routing, and much more.

As a result, large and small enterprises are embracing containers quicker than ever, and the field is growing exponentially. According to businesswire.com, the application container market shows a compounded growth of 31% per annum and will reach $6.9 billion by 2025. The exponential growth of 30.3% per annum in the cloud, expected to reach over $2.4 billion by 2025, has also contributed to this.

Therefore, modern DevOps engineers must understand containers and the relevant technologies to ship and deliver containerized applications effectively. This does not mean that virtual machines are unnecessary, and we cannot completely ignore the role of IaaS-based solutions in the market, so we will also cover some config management with Ansible in further chapters. Due to the advent of the cloud, IaC has been gaining much momentum recently, so we will also cover Terraform as an IaC tool.