IMPORTANT NOTE: This site is not official Red Hat documentation and is provided for informational purposes only. These guides may be experimental, proof of concept, or early adoption. Officially supported documentation is available at and

Demonstrate GitOps on Managed OpenShift with ArgoCD

Authors: Steve Mirman, Connor Wooley
Last Editor: Dustin Scott
Published Date: 17 June 2021
Modified Date: 25 May 2023

Author: Steve Mirman

Video Walkthrough

If you prefer a more visual medium, you can watch Steve Mirman walk through this quickstart on YouTube .

The purpose of this document is to help you get OpenShift GitOps running in your cluster, including deploying a sample application and demonstrating how ArgoCD ensures environment consistency.

This demo assumes you have a Managed OpenShift Cluster available and cluster-admin rights.

GitHub resources referenced in the demo:

Required command line (CLI) tools

Environment Set Up

Install the OpenShift GitOps operator

  1. Install the OpenShift GitOps operator from the Operator Hub

    screenshot of GitOps install

Pull files from GitHub

  1. Clone the gitops-demo GitHub repository to your local machine

    git clone gitops
  2. Export your local path to the GitHub files

    export GITOPS_HOME="$(pwd)/gitops"

Log in to OpenShift via the CLI

  1. Retrieve the login command from the OpenShift console
    screenshot of login

  2. Enter the command in your terminal to authenticate with the OpenShift CLI (oc)

    Output should appear similar to:

    Logged into "https://<YOUR-INSTANCE>" as "<YOUR-ID>" using the token provided.

Deploy the ArgoCD Project

Create a new OpenShift project

  1. Create a new OpenShift project called gitops
    oc new-project gitops

Edit service account permissions

  1. Add cluster-admin rights to the openshift-gitops-argocd-application-controller service account in the openshift-gitops namespace
    oc adm policy add-cluster-role-to-user cluster-admin -z openshift-gitops-argocd-application-controller -n openshift-gitops

Log in to ArgoCD

  1. Retrieve ArgoCD URL:

    argoURL=$(oc get route openshift-gitops-server -n openshift-gitops -o jsonpath='{}{"\n"}')
    echo $argoURL
  2. Retrieve ArgoCD Password:

    argoPass=$(oc get secret/openshift-gitops-cluster -n openshift-gitops -o jsonpath='{.data.admin\.password}' | base64 -d)
    echo $argoPass
  3. In a browser, navigate to the ArgoCD console using the $argoURL value returned above
    screenshot of argocd1

  4. Log in with the user name admin and the password returned as $argoPass above
    screenshot of argocd2

    Optional step if you prefer CLI access Login to the CLI:

    argocd login --insecure --grpc-web $argoURL  --username admin --password $argoPass

Deploy the ArgoCD project

  1. Use kubectl to apply the bgd-app.yaml file

    kubectl apply -f documentation/modules/ROOT/examples/bgd-app/bgd-app.yaml

    The bgd-app.yaml file defines several things, including the repo location for the gitops-bgd-app application
    screenshot of bgd-app-yaml

  2. Check the rollout running the following command:

    kubectl rollout status deploy/bgd -n bgd
  3. Once the rollout is complete get the route to the application

    oc get route bgd -n bgd -o jsonpath='{}{"\n"}'
  4. In your browser, paste the route to open the application
    screenshot of app_blue

  5. Go back to your ArgoCD window and verify the configuration shows there as well
    screenshot of argo_app1

  6. Exploring the application in ArgoCD, you can see all the components are green (synchronized)
    screenshot of argo_sync

Deploy a change to the application

  1. In the terminal, enter the following command which will introduce a chance into the bgd application

    kubectl -n bgd patch deploy/bgd --type='json' -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/env/0/value", "value":"green"}]'
  2. Go back to your ArgoCD window. The application should no longer be synchronized
    screenshot of argo_sync

  3. Refresh the bgd application window and notice the change in box color
    screenshot of bgd_green

    The new deployment changed the box from blue to green, but only within OpenShift, not in the source code repository

Synchronize the application

  1. In the ArgoCD console, click the SYNC button to re-synchronize the bgd application with the approved configuration in the source code repository
    screenshot of sync_bgd

  2. Refresh the bgd application window and notice the change in box color
    screenshot of app_blue

Details from GitHub perspective