Skip to main content
AI
  • Get started with AI

    • Red Hat AI

      Accelerate the development and deployment of enterprise AI solutions.

    • AI learning hub

      Explore learning materials and tools, organized by task.

    • AI interactive demos

      Click through scenarios with Red Hat AI, including training LLMs and more.

    • AI/ML learning paths

      Expand your Red Hat OpenShift AI knowledge using these learning resources.

    • AI quickstarts

      Focused AI use cases designed for fast deployment on Red Hat AI platforms.

    • No-cost AI training

      Foundational Red Hat AI training.

  • Featured resources

    • Red Hat OpenShift AI
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

Red Hat AI Factory with NVIDIA

Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.

Learn
  • Self-guided

    • Documentation

      Find answers, get step-by-step guidance, and learn how to use Red Hat products.

    • Learning paths

      Explore curated walkthroughs for common development tasks.

    • Guided learning

      Receive custom learning paths powered by our AI assistant.

    • See all learning
  • Hands-on

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

    • Interactive labs

      Learn by doing in these hands-on, browser-based experiences.

    • Interactive demos

      Click through product features in these guided tours.

  • Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics
  • Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
Build
  • Get started

    • Red Hat build of Podman Desktop

      A downloadable, local development hub to experiment with our products and builds.

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

  • Download products

    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products
  • Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset
  • References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
Community
  • Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions
  • Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github
  • Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

Join the Red Hat Developer program

Download Red Hat products and project builds, access support documentation, learning content, and more.

ConsoleDocsSupport Search
New For you

Recommended

We'll recommend resources you may like as you browse. Try these suggestions for now.

  • Product downloads
  • Cheat sheets
  • Red Hat Developer learning portal
  • Developer blog
  • E-books
  • Developer Sandbox
Log in

Get more with a Red Hat Developer account

  • Product downloads
  • Console access
  • Event registration
  • Training & trials
Explore more account benefitsLog in or register

A subscription may be required for some services.

Contact us

Dynamically scale the Argo CD application controller with OpenShift GitOps 1.10

September 26, 2023
Ishita Sequeira
Related topics:
GitOpsKubernetesOperators
Related products:
Red Hat OpenShift Container Platform

    Prior to Red Hat OpenShift GitOps 1.10, the Operator supported setting the number of desired shards via a first-class setting in the Argo CD custom resource using the variable controller.sharding.replicas. The user still had to decide on the number of shards they wanted to have running. To make this an informed decision, users needed to consider the number of managed clusters per shard.

    Although this functionality helps define the number of replicas of Argo CD application controllers needed, it does not necessarily end up having the optimal use of the compute resources across all shards. For example, setting 2 shards may be too small for handling 10 clusters, while setting 50 shards will leave 40 shards unused and still consume the assigned compute resources.

    To solve this problem, OpenShift GitOps 1.10 introduced dynamic scaling of replicas. This article describes the properties introduced to enable dynamic scaling and explains how dynamic scaling works.

    Enabling the dynamic scaling feature

    The Operator introduced the following properties in the ArgoCD custom resource definition (CRD) to enable the dynamic scaling feature:

    • Sharding.dynamicScalingEnabled: Whether to enable dynamic scaling of the Argo CD application controller component. This will ignore the configuration of Sharding.enabled and Sharding.replicas.
      • Default value: true
    • Sharding.minShards: The minimum number of replicas of the Argo CD application controller component.
      • Default value: 1
    • Sharding.maxShards: The maximum number of replicas of the Argo CD application controller component.
      • Default value: 1
    • Sharding.clustersPerShard: The number of clusters that need to be handled by each shard. If the replica count has reached the maxShards, the shards will manage more than one cluster.
      • Default value: 1

    Setting the property Sharding.dynamicScalingEnabled will enable the dynamic scaling feature and will override the behavior of existing properties Sharding.enabled and Sharding.Replicas.

    The number of replicas is computed based on the following condition:

    Number of Replicas = (Total Number of Clusters managed by ArgoCD) / (Sharding.clustersPerShard)

    If the result of the above formula, that is, the computed number of replicas, is less than the value of property Sharding.minShards, the Operator sets the replicas equal to the value of Sharding.minShards. Similarly, if the computed value of replicas exceeds Sharding.maxShards, then the number of replicas is set as the value of Sharding.maxShards.

    Dynamic scaling example

    Step 1: Let's install GitOps Operator and add the configuration below to the pre-installed Argo CD configuration.

    spec:
    	controller:
    		sharding:
    			dynamicScalingEnabled: true
    			minShards: 1
    			maxShards: 3
    			clustersPerShard: 1

    In this example, we are only taking clustersPerShard as 1 for easier demonstration. This means one shard will manage only one cluster before increasing the number of replicas of the application controller. The shard will manage more than 1 cluster when the replicas of the application controller match the value of maxShards.

    Step 2: Once the Operator is up and running, install the argocd CLI following the instructions here. We will use argocd CLI to add clusters to the Argo CD instance.

    Step 3: Connect the argocd CLI to the Argo CD instance using the below command:

    $ argocd login <argocd_server_url>
    username: admin
    password: <secret openshift_gitops_cluster>

    The argocd server URL can be found in the from the route of openshift-gitops-server pod, as shown in Figure 1.

    Argo CD Server Details Page from ArgoCD Installation from Gitops Operator
    Figure 1: Argo CD server details page.

    We can get the password from the secret openshift-gitops-cluster in namespace openshift-gitops.

    Let’s check the number of application controller replicas created by default:

    $ kubectl get pods -n openshift-gitops | grep application-controller
    openshift-gitops-application-controller-0       1/1     Running   0          35s

    Step 4: Now, add the clusters to Argo CD using the following command:

    $ argocd cluster add CONTEXT [flags]

    More details about the command can be found at on the Argo CD project website.

    For this example, I have added 1 cluster that I created using kind. Once the clusters are added, you can see the number of application controller replicas increasing. You can view the number of replicas using the kubectl command below.

    $ kubectl get pods -n openshift-gitops | grep application-controller
    openshift-gitops-application-controller-0       1/1     Running   0          4m21s
    openshift-gitops-application-controller-1       1/1     Running   0          14s

    Step 5: You can remove the clusters from Argo CD using the below command. More details about the command can be found here. 

    $ argocd cluster rm SERVER/NAME

    Once the cluster is deleted, we can see the replicas of the application controller decrease:

    $ kubectl get pods -n openshift-gitops | grep application-controller
    openshift-gitops-application-controller-0       1/1     Running   0          7m36s

    One thing to note is that the number of replicas of the application controller would never go below the value of sharding.minShards field and would never exceed the value of sharding.maxShards field.

    Conclusion

    The OpenShift GitOps operator's auto-scaling feature will provide a fire-and-forget mechanism when adding or removing managed clusters to an Argo CD instance. This also reduces the manual intervention by the operators and automates scaling of the application controller.

    Last updated: October 26, 2023

    Related Posts

    • 3 patterns for deploying Helm charts with Argo CD

    • How to use OpenShift GitOps to deploy applications

    • Manage namespaces in multitenant clusters with Argo CD, Kustomize, and Helm

    • How OpenShift GitOps notifications can trigger pipelines

    • 5 global environment variables provided by OpenShift GitOps

    • Multiple sources for Argo CD applications

    Recent Posts

    • A day in the life of an NVIDIA H100 on Red Hat OpenShift 5

    • Migrate BuildConfigs to builds for Red Hat OpenShift with one plug-in install

    • Run Red Hat Enterprise Linux CoreOS on NVIDIA BlueField DPUs

    • Agent harness engineering: Separating model capabilities from enforcement

    • What's new for developers in Red Hat Enterprise Linux 10.3 and 9.9

    What’s up next?

    Path to GitOps cover card

    Read The Path to GitOps for a comprehensive look at the tools, workflows, and structures teams need to have in place in order to enable a complete GitOps workflow.

    Get the e-book
    Red Hat Developers logo

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    Red Hat Developer

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility
    Ask AI