Argo CD 101



Why Argo CD ??

Because it fulfills all the points of the GitOps principle. As it extends the benefits of declarative specifications, acting as a GitOps Operator, follows a pull-based approach,  and considers Git as a source of truth for configuration management.

It follows a pattern of reconciliation i.e. continuously performing a control loop every 3 minutes to achieve the desired state by fetching the desired configuration from Git.

Let’s understand it in more detail, how can we achieve or implement GitOps using Argo CD ??

We all know that every company and every developer uses Git as a source code management software to store code. Developers can commit their infrastructure configurations, such as Kubernetes resource manifest, in Git to create the environment needed for application deployment. Once a developer implements a feature( with new applications and Kubernetes configurations) and merges the main branch. With the help of the GitOps agent or GitOps operator, Argo CD will immediately identify the new versions of configurations that were recently merged and compare them with the running manifest in the cluster. In case of a mismatch, it highlights out-of-sync status, and in the backend, Argo CD uses the Kubernetes controller to reconcile the new changes to the cluster. Once the Kubernetes resources are ready, it informs the user that the application is in sync. Finally, Argo CD synchronizes the current state with the declared state of configurations and ensures the new configurations are correctly deployed in the cluster.

What is  Argo CD ??

Argo CD is a declarative, GitOps continuous delivery( CD ) tool for cloud-native applications. As we know Kubernetes is by default an environment for cloud-native apps and uses manifest files for its configuration. Hence, all the manifests(or configuration files) required for cloud-native apps are defined in a Git repository, as Git is considered as a single source of truth for GitOps i.e. Argo CD.
One of Argo's CD components called the application controller continuously monitors and compares the desired state (present in Git) manifest with the live state (present in Cluster) manifest.

It reports the deviations b/w the live state and the desired state and provides the visualization in Argo CD UI to help developers manually or automatically sync the live state with the desired state.

How does Argo CD work ??

Under the hood, it uses the concept of reconciliation to achieve the desired state in the cluster.  The concept of reconciliation is implemented via an Argo CD operator called an Application controller.

NOTE:
  • But how does the Argo CD operator know about the source and destination?
    • Source represents a git repository where all the desired manifests are defined.
    • Whereas, the destination represents the target environment known as the cluster.
  • Argo CD operator knows via custom resource definition(CRD) called Application resources. We will learn about Application resources in the next blog.




Let's understand the Architecture of Argo CD to understand more about the components of Argo CD such as the Application controller, etc.

  Argo CD Architecture





Argo CD control plane consists of 3 essential components:
  • Application Controller,
  • API Server and,
  • Repository Server


Application Controller

As we know Kubernetes resource for say deployment has its own controller that is known as the deployment controller. The duty of the deployment controller is to achieve the declared state in the deployment manifest. Similarly, an Application is one type of resource that has its own controller known as an Application controller. Similarly, the duty of the application controller is to observe the live state of the app's manifest and make a comparison with the desired state in the Git repository. Whenever there is a new manifest version in Git and the state is not synced, then the controller will try to fix it and match the live state with the desired state. It detects out-of-sync status between the running environment and Git and highlights it as well as notifies it.

For more refer to docs.


Repository Server:

The Repository server of Argo CD is responsible for maintaining the local cache of the Git repo. Other Argo CD service makes a request to the repository server in order to get the Kubernetes manifest by providing the input, such as repository URL, Git revisions(branch, tags), application path, and template-specific settings. And in return, the server generates Kubernetes manifests.
For more refer to docs.


API Server:

The API server is the gRPC/REST server, which exposes the API endpoints consumed by the Argo CD Web UI and CLI, and other CI/CD systems. The APIs are primarily used to carry out functionalities such as application deployment and management, executing rollback or any-user-defined actions, storing K8S cluster credentials, having AuthN/Z for security and compliance, etc.

For more refer to docs.


Argo CD features ??

  • GitOps Style Deployment:
    • Based on GitOps style software delivery. Declare the desired state as an application or infrastructure resource in Git, and Argo CD will automatically synchronize the application configuration to the currently desired state.
  • Automatic Deployment:
    • ArgoCD can automatically deploy an application to specific targets in multiple clusters.
  • Deployment Strategies:
    • It also has an option to Rollback to any application configurations committed to the git repository.
  • Deployment issue:
    • It can also automatically detect configuration drift and also gives visualization to pinpoint the differences.
  • Single Sign-on-authentication
    • It can also integrate with SSO(Single Sign Option) for various third-party products such as OIDC, OAuth2, LDAP, SAML, GitHub, GitLab, Microsoft, LinkedIn, etc to enable access for your teams in Argo CD.
  • RBAC and Multitenancy
    • It also supports multi-tenancy and RBAC policies for authorizations.
    • It provides role-based access control to manage the authorization of team members to specific services and clusters.
  • Extensible and support:
    • Platform engineers and DevOps folks use various techniques to define Kubernetes manifest files such as YAML, Helm Charts, Ksonnet, Kustomize, and jsonnet files. Argo CD provides the capability to track any type of Kubernetes manifest.  Therefore, it supports multiple configuration management/templating tools.
    • It also synchronizes the application based on the webhook integrations. It can react to any push or merge events to github, BitBucket, Gitlab, etc.
    • It also provides out-of-the-box Prometheus metrics.
    • It also has a lot of options like Pre-Sync and Post-Sync hooks to support complex application rollouts.
  • CLI and Web UI:
    • It also provides CLI and access tokens for automation and CD integration.
    • It also gives a Web UI which provides a real-time view of application activity.


Next, we will learn about a custom resource called Application resource.

Comments

All Post

Logging ??

What is GitOps in easy way ??

AWS and its Services ??

Observability 101

Prometheus Architecture...

Why need of Cloud Computing ??

Build a Slack activity dashboard with Metabase

Monitoring 101

Application Resource in Argo CD