Introduction
When I first began using ArgoCD to manage continuous deployment to manage the homelab, I quickly learned that ArgoCD provides two discovered deployments: ArgoCD Applications and ApplicationSet. I had to figure out the differences between these options to choose the right tool for the job and set up an effective deployment workflow without going overboard.
What is ArgoCD?
Before we dive into the comparison, let’s see what ArgoCD is. ArgoCD is a declarative, GitOps-based continuous delivery tool for Kubernetes. It allows you to manage and define the desired state of your applications straight from a Git repository, automating deployments and keeping things consistent across environments.
Applications vs ApplicationSet
Application
An Application in ArgoCD is a single deployment unit that defines the desired state of a Kubernetes application. It directly references a Git repository containing the application manifests (deployment manifests, helm, etc), which ArgoCD uses to sync and manage the applications on the Kubernetes cluster.
When to Use an Application:
- Single and Unique Deployments: Ideal for deploying single applications that require specific configurations without multiple instances or variations.
- Simple and Tailored Environments: Suitable for straightforward environments with stable configurations and distinct needs.
- Granular Control: Perfect for scenarios requiring detailed control over each deployment, such as staging, testing, and production environments.
- Limited Scope: Best for managing a small number of applications with minimal scaling requirements.
Use Case Example:
- Standalone Service: Deploying a standalone web service with its own repository. For instance, a company’s dashboard application requires direct updates and maintenance.
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: standalone-service
spec:
project: default
source:
repoURL: 'https://github.com/example/standalone-service.git'
targetRevision: HEAD
path: chart
helm:
valueFiles:
- ../values.yaml
destination:
server: 'https://kubernetes.default.svc'
namespace: staging
syncPolicy:
automated: {}
What is an ApplicationSet?
An ApplicationSet is a more advanced resource that allows the dynamic generation of multiple Applications based on a template and parameters. This is particularly useful for managing large-scale environments and handling multiple instances of applications with varied configurations.
When to Use an ApplicationSet:
- Multiple Instances and Similar Applications: Ideal for deploying and managing multiple application instances with different parameters. These are the best configurations.
- Complex and Scalable Environments: Best for multi-cluster, multi-region, or dynamic deployments requiring efficient scaling.
- Dynamic Generation: Suitable for scenarios where applications need to be dynamically generated and managed from a template.
- Frequent Updates and Consistency: Efficient for environments with frequent configuration changes, ensuring uniformity across deployments.
- Reduced Manual Effort: Simplifies management by automating the deployment process, reducing manual intervention.
Use Case Example:
- Regional multi-cluster Deployments: Deploying a global e-commerce platform on different clusters, also possible to tailor the region-specific instances, each customized for local settings like language and currency.
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: e-commerce-platform
spec:
generators:
- list:
elements:
- cluster: us-west
url: 'https://us-west.example.com'
- cluster: eu-central
url: 'https://eu-central.example.com'
template:
metadata:
name: 'e-commerce-'
spec:
project: default
source:
repoURL: 'https://github.com/example/e-commerce.git'
targetRevision: HEAD
path: 'overlays/'
destination:
server: ''
namespace: e-commerce
syncPolicy:
automated: {}
Conclusion
Deciding between ArgoCD Applications and ApplicationSet really depends on your needs and deployment scenarios. If you’re looking for unique apps that need custom configurations, ArgoCD Applications could be your best bet. However, if you use several similar apps and want to keep things consistent, ApplicationSet can streamline the process.
Check out both options to see what works best for your deployment strategy. And remember, picking the right one can majorly boost your workflow efficiency and app management.