Argo CD in Practice

Book description

Build CD pipelines following GitOps principles like declarative and immutable changes stored in version control, all continuously reconciled by Argo CD, and minimize the failure of deployments.

Purchase of the print or Kindle book includes a free eBook in the PDF format.

Key Features

  • Discover how to apply GitOps principles to build real-world CD pipelines
  • Understand Argo CD components and how they work together to reconcile cloud native applications
  • Learn to run Argo CD in production with declarative config changes, security, observability, disaster recovery, and more

Book Description

GitOps follows the practices of infrastructure as code (IaC), allowing developers to use their day-to-day tools and practices such as source control and pull requests to manage apps. With this book, you'll understand how to apply GitOps bootstrap clusters in a repeatable manner, build CD pipelines for cloud-native apps running on Kubernetes, and minimize the failure of deployments.

You'll start by installing Argo CD in a cluster, setting up user access using single sign-on, performing declarative configuration changes, and enabling observability and disaster recovery. Once you have a production-ready setup of Argo CD, you'll explore how CD pipelines can be built using the pull method, how that increases security, and how the reconciliation process occurs when multi-cluster scenarios are involved. Next, you'll go through the common troubleshooting scenarios, from installation to day-to-day operations, and learn how performance can be improved. Later, you'll explore the tools that can be used to parse the YAML you write for deploying apps. You can then check if it is valid for new versions of Kubernetes, verify if it has any security or compliance misconfigurations, and that it follows the best practices for cloud-native apps running on Kubernetes.

By the end of this book, you'll be able to build a real-world CD pipeline using Argo CD.

What you will learn

  • Understand GitOps principles and how they relate to IaC
  • Discover how Argo CD lays the foundation for reconciling Git state with the cluster state
  • Run Argo CD in production with an emphasis on reliability and troubleshooting
  • Bootstrap Kubernetes clusters with essential utilities following the GitOps approach
  • Set up a CD pipeline and minimize the failure of deployments
  • Explore ways to verify and validate the YAML you put together when working with Kubernetes
  • Understand the democratization of GitOps and how the GitOps engine will enable its further adoption

Who this book is for

If you're a software developer, DevOps engineer, or SRE who is responsible for building CD pipelines for projects running on Kubernetes and wants to advance in your career, this book is for you. Basic knowledge of Kubernetes, Helm, or Kustomize and CD pipelines will help you to get the most out of this book.

Table of contents

  1. Argo CD in Practice
  2. Foreword
  3. Contributors
  4. About the authors
  5. About the reviewer
  6. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Download the color images
    6. Conventions used
    7. Get in touch
    8. Share Your Thoughts
    9. Download a free PDF copy of this book
  7. Part 1: The Fundamentals of GitOps and Argo CD
  8. Chapter 1: GitOps and Kubernetes
    1. Technical requirements
    2. What is GitOps?
    3. Kubernetes and GitOps
      1. Architecture
      2. HTTP REST API server
      3. Controller manager
    4. Imperative and declarative APIs
      1. Imperative – direct commands
      2. Imperative – with config files
      3. Declarative – with config files
      4. Declarative – with config folder
    5. Building a simple GitOps operator
    6. IaC and GitOps
    7. Summary
    8. Further reading
  9. Chapter 2: Getting Started with Argo CD
    1. Technical requirements
    2. What is Argo CD?
      1. Getting familiar with Argo CD
    3. Core concepts and vocabulary
      1. Argo CD reconciliation
      2. Vocabulary
    4. Explaining architecture
      1. Architectural overview
      2. The core components of Argo CD
      3. The core objects/resources of Argo CD
      4. Running Argo CD locally with Helm
      5. Running the first Argo CD application
      6. Running Argo CD with Argo CD Autopilot locally
    5. Synchronization principles
      1. Resource hooks
      2. Sync waves
    6. Summary
    7. Further reading
  10. Part 2: Argo CD as a Site Reliability Engineer
  11. Chapter 3: Operating Argo CD
    1. Technical requirements
    2. Declarative configuration
      1. HA installation with Kustomize
      2. Argo CD self-management
      3. Configuration updates
    3. Setting up an HA installation
      1. API server
      2. Repository server
      3. Application controller
      4. Redis cache
      5. Dex server
    4. Planning for disaster recovery
      1. Installing the CLI
      2. Creating the backup
      3. Restoring on a different cluster
    5. Enabling observability
      1. Monitoring with Prometheus
      2. Metrics for the operating team
      3. Metrics for the microservices teams
    6. Notifying the end user
      1. Installing Argo CD Notifications
      2. Starting a pipeline
    7. Summary
    8. Further reading
  12. Chapter 4: Access Control
    1. Technical requirements
    2. Declarative users
      1. Admin and local users
    3. Service accounts
      1. Local service accounts
      2. Project roles and tokens
    4. Single sign-on
      1. SSO with Dex
      2. SSO with Argo CD directly
    5. Summary
    6. Further reading
  13. Part 3: Argo CD in Production
  14. Chapter 5: Argo CD Bootstrap K8s Cluster
    1. Technical requirements
    2. Amazon EKS with Terraform
      1. Getting familiar with Amazon EKS
      2. Designing EKS infrastructure
      3. Provisioning EKS with Terraform
    3. Bootstrapping EKS with Argo CD
      1. Preparing Argo CD Terraform
      2. Applying Argo CD Terraform
    4. Using the app of apps pattern
      1. Why the app of apps pattern?
      2. Bootstrapping utilities
    5. Bootstrapping in practice
      1. Destroying infrastructure
      2. Starting fresh infrastructure
      3. App of apps disadvantages
      4. What is ApplicationSet?
      5. Generators
    6. Summary
    7. Further reading
  15. Chapter 6: Designing Argo CD Delivery Pipelines
    1. Technical requirements
    2. Motivation
      1. Simple blue-green in K8s
    3. Deployment strategies
      1. What is Argo Rollouts?
      2. Why Argo Rollouts?
      3. The architecture of Argo Rollouts
      4. Blue-green deployment strategy
      5. Canary deployment strategy
    4. A real CI/CD pipeline
      1. Setting up Argo Rollouts
      2. Automated blue-green promotion with GitHub Actions
      3. Automated rolling out with sync phases
    5. Keeping secrets safe
      1. Storing secrets safely
      2. Argo CD and External Secrets Operator
    6. Microservices CI/CD
    7. Monorepo microservices
    8. Summary
    9. Further reading
  16. Chapter 7: Troubleshooting Argo CD
    1. Technical requirements
    2. Initial setup
    3. Addressing day-to-day issues
      1. Restarting components
      2. Using a specific version of Helm
    4. Improving performance
      1. Application controller
      2. Repository server
    5. Summary
    6. Further reading
  17. Chapter 8: YAML and Kubernetes Manifests
    1. Technical requirements
    2. Working with templating options
      1. Helm
      2. Kustomize
    3. Exploring types of validation
    4. Validating a Kubernetes schema
    5. Enforcing best practices for your manifests
    6. Performing extended checks with conftest
    7. Summary
    8. Further reading
  18. Chapter 9: Future and Conclusion
    1. Technical requirements
    2. Democratizing GitOps
    3. What is GitOps Engine?
      1. The GitOps agent
    4. What is kubernetes-sigs/cli-utils?
      1. kapply usage
    5. Wrap up
    6. Summary
    7. Further reading
  19. Index
    1. Why subscribe?
  20. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Share Your Thoughts
    3. Download a free PDF copy of this book

Product information

  • Title: Argo CD in Practice
  • Author(s): Liviu Costea, Spiros Economakis, Alexander Matyushentsev
  • Release date: November 2022
  • Publisher(s): Packt Publishing
  • ISBN: 9781803233321