Skip to content

OpenShift GitOps

Red Hat OpenShift GitOps Documentation

OpenShift GitOps provides ArgoCD for managing application deployments using GitOps workflows.

Install the Operator via WebUI

  1. Go to Ecosystem -> Software Catalog -> filter for "OpenShift GitOps" -> click the tile
  2. Click Install
  3. Leave all the defaults and click Install
  4. Wait for the Operator to install
  5. The operator automatically creates a default Argo CD instance in the openshift-gitops namespace

Install the Operator via YAML

apiVersion: v1
kind: Namespace
metadata:
  name: openshift-gitops-operator
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: openshift-gitops-operator
  namespace: openshift-gitops-operator
spec:
  upgradeStrategy: Default
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: openshift-gitops-operator
  namespace: openshift-gitops-operator
spec:
  channel: latest
  installPlanApproval: Automatic
  name: openshift-gitops-operator
  source: redhat-operators
  sourceNamespace: openshift-marketplace
oc apply -f gitops-operator.yaml

Wait for the operator CSV, then for the Argo CD pods (they run in openshift-gitops, not in the operator namespace):

oc get csv -n openshift-gitops-operator
oc wait --for=condition=Ready pods --all -n openshift-gitops --timeout=300s

Verify the Installation

oc get pods -n openshift-gitops

Access the Argo CD Console

  1. In the WebUI, the Argo CD link will appear in the grid menu (top right) once the operator is installed
  2. You can log in using OpenShift OAuth
  3. To get the default admin password via CLI:
oc extract secret/openshift-gitops-cluster -n openshift-gitops --keys=admin.password --to=-

Grant Argo CD Access to a Namespace

oc label namespace <class 'jinja2.utils.Namespace'> argocd.argoproj.io/managed-by=openshift-gitops

Create an Application

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: my-app
  namespace: openshift-gitops
spec:
  project: default
  source:
    repoURL: https://github.com/example/my-app.git
    targetRevision: main
    path: manifests
  destination:
    server: https://kubernetes.default.svc
    namespace: my-app
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
      - CreateNamespace=true
oc apply -f application.yaml