Chapter 9. Automating application management with the GitOps controller


You can consistently configure and deploy Kubernetes-based infrastructure and applications across node and development lifecycles by using the declarative Red Hat OpenShift GitOps engine.

9.1. What you can do with the GitOps agent

You can manage application lifecycles and use automated processes to manage application changes with Red Hat OpenShift GitOps.

GitOps with Argo CD for MicroShift is a lightweight, optional add-on controller derived from the GitOps Operator.

The GitOps agent for MicroShift uses the command-line interface (CLI) of Argo CD to interact with the GitOps controller. The controller acts as the declarative GitOps engine. By using the GitOps with Argo CD agent for MicroShift, you can use the following principles:

  • Implement application lifecycle management:

    • Create and manage your node and application configuration files using the core principles of developing and maintaining software in a Git repository.
    • You can update the single repository and GitOps automates the deployment of new applications or updates to existing ones.
    • For example, if you have 1,000 edge devices, each using MicroShift and a local GitOps agent, you can easily add or update an application on all 1,000 devices with just one change in your central Git repository.
  • The Git repository contains a declarative description of the infrastructure you need in your specified environment and contains an automated process to make your environment match the described state.
  • You can also use the Git repository as an audit trail of changes so that you can create processes based on Git flows such as review and approval for merging pull requests that implement configuration changes.

Using Red Hat OpenShift GitOps with Argo CD for MicroShift is different from using the entire GitOps Operator in the following ways:

  • The gitops-operator component is not used with MicroShift.
  • To maintain the small resource use of MicroShift use the Argo CD CLI. The Argo CD web console is not available.
  • Because MicroShift is single-node, there is no multi-node support. Each instance of MicroShift is paired with a local GitOps agent.
  • The oc adm must-gather command is not available in MicroShift.

You can use a lightweight version of Red Hat OpenShift GitOps with MicroShift to help manage your applications by installing the microshift-gitops RPM package.

The microshift-gitops RPM package includes the necessary manifests to run core Argo CD.

Important

The Argo CD web console is not available on MicroShift. This process installs basic GitOps functions.

Prerequisites

  • You installed MicroShift version 4.16 or later.
  • You configured 250MB RAM of additional storage.

Procedure

  1. Enable the GitOps repository with the subscription manager by running the following command:

    $ sudo subscription-manager repos --enable=gitops-1.16-for-rhel-9-$(uname -m)-rpms
    Copy to Clipboard Toggle word wrap
  2. Install the MicroShift GitOps package by running the following command:

    $ sudo dnf install -y microshift-gitops
    Copy to Clipboard Toggle word wrap
  3. To deploy Argo CD pods, restart MicroShift by running the following command:

    $ sudo systemctl restart microshift
    Copy to Clipboard Toggle word wrap

Verification

  • You can verify that your pods are running properly by entering the following command:

    $ oc get pods -n openshift-gitops
    Copy to Clipboard Toggle word wrap

    Example output

    NAME                                  READY   STATUS    RESTARTS   AGE
    argocd-application-controller-0       1/1     Running   0          4m11s
    argocd-redis-56844446bc-dzmhf         1/1     Running   0          4m12s
    argocd-repo-server-57b4f896cf-7qk8l   1/1     Running   0          4m12s
    Copy to Clipboard Toggle word wrap

9.4. Creating GitOps applications on MicroShift

You can create a custom configuration by using a YAML file to deploy and manage applications in your MicroShift service after you install the Red Hat OpenShift GitOps Argo CD manifests from an RPM package.

Prerequisites

  • You installed the microshift-gitops packages.
  • The Argo CD pods are running in the openshift-gitops namespace.

Procedure

  1. Create a YAML file and add your customized configurations for the application:

    Example YAML for a spring-petclinic application

    kind: AppProject
    apiVersion: argoproj.io/v1alpha1
    metadata:
      name: default
      namespace: openshift-gitops
    spec:
      clusterResourceWhitelist:
      - group: '*'
        kind: '*'
      destinations:
      - namespace: '*'
        server: '*'
      sourceRepos:
      - '*'
    ---
    kind: Application
    apiVersion: argoproj.io/v1alpha1
    metadata:
      name: spring-petclinic
      namespace: openshift-gitops
    spec:
      destination:
        namespace: spring-petclinic
        server: https://kubernetes.default.svc
      project: default
      source:
        directory:
          recurse: true
        path: app
        repoURL: https://github.com/siamaksade/openshift-gitops-getting-started
      syncPolicy:
        automated: {}
        syncOptions:
        - CreateNamespace=true
        - ServerSideApply=true
    Copy to Clipboard Toggle word wrap

  2. To deploy the applications defined in the YAML file, run the following command:

    $ oc apply -f <my_app.yaml>
    Copy to Clipboard Toggle word wrap

    Replace <my_app.yaml> with the name of your application YAML.

Verification

  • To verify your application is deployed and synced, run the following command:

    $ oc get applications -A
    Copy to Clipboard Toggle word wrap

    Wait a few minutes for the application to show a Healthy status.

    Example output

    NAMESPACE          NAME               SYNC STATUS   HEALTH STATUS
    openshift-gitops   spring-petclinic   Synced        Healthy
    Copy to Clipboard Toggle word wrap

9.5. Debugging GitOps with oc adm inspect

If you have problems with your Argo CD for MicroShift Red Hat OpenShift GitOps controller, you can use the OpenShift CLI (oc) tool to inspect it for errors.

Prerequisites

  • The oc command-line tool is installed.

Procedure

  • Run the oc adm inspect command when in the GitOps namespace:

    $ oc adm inspect ns/openshift-gitops
    Copy to Clipboard Toggle word wrap

    Example output

    Gathering data for ns/openshift-gitops...
    W0501 20:34:35.978508 57625 util.go:118] the server doesn't have a resource type egressfirewalls, skipping the inspection
    W0501 20:34:35.980881 57625 util.go:118] the server doesn't have a resource type egressqoses, skipping the inspection
    W0501 20:34:36.040664 57625 util.go:118] the server doesn't have a resource type servicemonitors, skipping the inspection
    Wrote inspect data to inspect.local.2673575938140296280.
    Copy to Clipboard Toggle word wrap

Next steps

  • If oc adm inspect did not show the information you need, you can run an sos report.
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat