Presenters

Source

🚀 Scaling GitOps: Mastering Argo CD Application Sets for Multi-Cluster Management

In the world of Kubernetes, Argo CD has earned its reputation as a premier CNCF project. While its sleek UI is often the “hook” that helps developers visualize resource dependencies and finally understand their clusters, the real magic happens under the hood.

According to Kostis, a Developer Advocate at Octopus Deploy and a core member of the Argo team, moving from a hobbyist homelab to a battle-hardened production environment requires a shift in strategy. The secret weapon? Application Sets.


📉 The Scaling Wall: Horizontal vs. Vertical

As your organization grows, the complexity of your deployments doesn’t just add up—it multiplies. Teams usually hit a wall in two specific directions:

  • Horizontal Scale: This involves deploying the same application across a fleet of clusters (e.g., deploying your core API to 50 regional nodes).
  • Vertical Scale: This involves managing hundreds of different applications within a single, massive cluster.
  • The Intersection: In production, you often face both. Imagine a billing app that needs to live on Cluster A, B, and C, but each instance requires a unique regional configuration.
  • The Nightmare: Manually writing 100 individual Application manifests for 10 apps across 10 clusters is an operational trap. Application Sets solve this by acting as a high-speed factory for your Application CRDs.

🛠️ The Power User’s Toolkit

To build a scalable GitOps pipeline, you need more than just the basics. Here are the core technologies that make automated scaling possible:

  • Argo CD: The foundational engine for GitOps.
  • Application Sets: The controller that enables multi-cluster and multi-repo support at scale.
  • Generators: The “brains” inside Application Sets. This includes the Git Generator, Cluster Generator, and the powerful Matrix Generator (which combines the logic of two generators).
  • Helm & Kustomize: The industry-standard packaging tools used to define your manifests.
  • vCluster: A vital tool for spinning up virtual clusters within physical ones to test your GitOps logic without breaking production.
  • Sprig Library: A template function library that allows Application Sets to use advanced logic, making them as flexible as Helm templates.

🏗️ Architectural Patterns for Success

Scaling isn’t just about the tools; it’s about how you arrange them. Kostis highlights several critical patterns (and a few dangerous traps) to watch out for:

  • The Three-Layer Pattern: Don’t choose between “App of Apps” and “Application Sets.” Use them together!
    • Base Layer: Your raw Kubernetes manifests (Helm or Kustomize).
    • Middle Layer: Application Sets that reference those bases.
    • Top Layer: A single App of Apps manifest that groups and manages your Application Sets.
  • Beware the “Helm Sandwich”: This is a common anti-pattern where teams use Helm to template an Argo CD Application CRD, which then points to another Helm chart.
    • The Risk: This creates a confusing hierarchy of values that makes local testing nearly impossible.
    • The Fix: Use the native templating of Application Sets and Sprig functions to handle logic. Keep it simple and flat.
  • Simple Sets > The Monstrosity: There is no prize for fitting your entire infrastructure into one file.
    • The Challenge: Massive, all-encompassing Application Sets become fragile and terrifying to edit.
    • The Recommendation: Break your logic into 5 to 10 focused Application Sets. It’s better to have several clear files than one “monstrosity” that no one dares to touch.

🏷️ Clusters as Groups, Not Pets

One of the biggest hurdles to scaling is treating clusters like “pets” (giving them unique names and manual attention).

  • The Old Way: Manually listing specific cluster names in your manifests.
  • The GitOps Way: Use Cluster Labels. Tag your clusters with metadata like env: production, region: EU, or team: billing.
  • The Benefit: When you provision a new cluster via Terraform or Crossplane and apply the right labels, Argo CD automatically detects it.
  • The Reality: 99% of developers don’t actually want a new cluster; they want a cluster that behaves exactly like the existing staging or production environment. Labels make this “copy-paste” infrastructure a reality.

🤖 Automating the Developer Experience: PR Generators

To truly empower a dev team, you need to automate the lifecycle of their code. The Pull Request (PR) Generator is a game-changer for modern workflows:

  • Instant Feedback: It monitors your source code repository and automatically creates a preview environment (a new Application CRD) the moment a PR is opened.
  • The Lifecycle: Argo CD manages the entire journey—creating the environment, updating it as new commits are pushed, and automatically destroying it when the PR is merged or closed.
  • The Result: This eliminates environment drift and ensures that orphaned resources aren’t left running (and costing money) indefinitely.

✨ Final Thoughts

The transition to enterprise-grade GitOps is all about moving from manual management to defined intent. As Kostis points out, Application Sets are the answer to almost every “How do I distribute X to Y?” question in the Kubernetes ecosystem.

Key Takeaways:

  • Stop managing individual manifests; start managing Generators.
  • Treat clusters as Groups, not Pets, using labels for automation.
  • Avoid the Helm Sandwich to keep your sanity during debugging.
  • Join the CNCF Slack channels (Argo CD and Argo Rollouts) to connect with the community and get production-ready advice.

Stop fighting your clusters and start orchestrating them. Let your Application Sets do the heavy lifting! 🦾🌐🎯

Appendix