Getting Started with Argo CD: A Beginner’s Guide
Understanding the Components, Features and Install
The article series consists of the following headings.
- 1- Understanding the Components, Features and Install
- 2- Public repository example
- 3- Private repository example
- 4- App-of-apps behaivours
- 5- Image Updater Install and Example
Introduction
Argo CD is a GitOps Continuous delivery tool for Kubernetes environments. Argo CD has an architecture that references the “Single Source of Truth” model, which is the basic building block of GitOps.
ArgoCD advantages:
- Faster deployments
- Safer distributions
- Faster rollback
- Simple control
- Better traceability
- Eliminate configuration drift
Key features of Argo CD
- GitOps Approach: Argo CD is based on GitOps principles. According to these principles, application state and configuration are stored in a Git repository. This allows application state and configuration to be managed and tracked like code.
- Continuous Deployment: Argo CD enables continuous deployment of applications running on Kubernetes. New versions, changes, or configuration updates can be automatically applied based on changes in the Git repository.
- Change Tracking and Rollback: Argo CD tracks changes made and updates the application state based on those changes. It also offers the ability to undo changes made.
- Declarative Application Definition: Application state and configuration are defined through YAML-based declarative files. These files specify application, service and other resources.
- Multimedia Support: Argo CD supports application deployment across different environments (e.g. dev, test, prod). A separate configuration can be defined for each environment.
- Customizable Application Status Control: Argo CD provides sample flexibility to customize the application health checking process and add custom checkpoints as needed.
- Web Based User Interface: Argo CD provides an easy-to-use web-based interface for users. This interface offers application status, history changes, and the ability to switch between applications.
- Open Source and Wide Ecosystem Support: Argo CD is an open source project and works in harmony with the Kubernetes ecosystem. It also comes with a wide ecosystem that offers a number of plugins and integrations.
ArgoCD Install
You can install argocd with the following command.
# latest version install
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
# v2.11.3
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/v2.11.3/manifests/install.yaml
# checking all object
kubectl get all -n argocd
After installing, you can use the command below to get the password for argocd ui login. But first, we need to open the service to the outside as nodeport.
# patch to nodePort
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "NodePort"}}'
# show admin password
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d && echo ""
- ArgoCD-UI: kubernetes_master_node_ip : NodePort_Ip
- Username: admin
- Password: is the string value resulting from the above command.
Application.yaml Description for ArgoCD
You can see the application.yaml manifest example below. To explain this .yaml keyword a little.
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: example-application
namespace: argocd
labels:
owner: deniz turkmen
spec:
destination:
server: https://kubernetes.default.svc
namespace: default
project: default
source:
repoURL: <repository_url>
targetRevision: <branch_or_commit>
path: <path_to_yaml_files>
syncPolicy:
automated:
prune: true
selfHeal: true
Now, let’s break down the YAML file in detail:
apiVersion
: Specifies the API version of the ArgoCD resource.kind
: Specifies the kind of resource, which in this case is an application.metadata
: Contains metadata about the application.name
: Specifies the name of the application.namespace
: Specifies the namespace in which the application resides. Here, it's in the argocd namespace.labels
: Contains labels to help identify and manage the application.spec
: Contains the specification of the application.project
: Specifies the ArgoCD project the application belongs to. In this case, it's the default project.destination
: Specifies where the application should be deployed.server
: Specifies the Kubernetes API server URL.namespace
: Specifies the namespace where the application should be deployed.source
: Specifies the source of the application manifest files.repoURL
: Specifies the URL of the Git repository containing the application manifests.targetRevision
: Specifies the Git branch, tag, or commit SHA to sync the application to. Here, it's set to themain
branch.path
: Specifies the directory within the repository containing the application manifests. In this case, it'smanifests
.syncPolicy
: Specifies the synchronization policy for the application.automated
: Specifies that synchronization should be automated.prune
: Specifies whether resources that are no longer defined in the Git repository should be pruned.selfHeal
: Specifies whether ArgoCD should attempt to reconcile the live state of the application with the desired state defined in the Git repository.
Application Healty Status;
Argo CD tracks synced/out-of-sync status as well as service status for each deployed application. Health status is shown in the user interface.
- Healthy: The source is 100% healthy.
- Progressing: The source is not healthy but it can be healthy.
- Suspended: The source is suspended and stopped. Cronjob example of typically.
- Missing: There is no resources in the cluster.
- Degraded: Resource status indicates failure or the resource did not reach a healthy state in time.
- Unknown: Health assessment failed and true health status is unknown.
Conclusion
As a result, argocd is a very powerful continuous delivery tool. It has fast deployment, rollback, powerful features and components. Additionally, the UI is useful for management.