Skip to content

Deploy with GitOps

Deploy applications by storing Kubernetes manifests in Git repositories and syncing them to your cluster using Argo CD.

What is GitOps?

GitOps uses Git repositories as the single source of truth for your infrastructure and application definitions. Changes to the cluster are made by committing to Git and synchronizing in Argo CD, rather than running kubectl commands.

Benefits:

  • Version Control - All changes tracked in Git history
  • Rollback - Easy reversion to previous states
  • Audit Trail - Who changed what and when
  • Desired State - Git repository defines the desired state of your cluster

Quick Start: Deploy Your First Application

Prerequisites

  • Argo CD installed and configured in your cluster
  • A Git repository with your Kubernetes manifests
  • Access to the Argo CD UI

Create Your Application Repository

This is a basic example to get started. Organize your Kubernetes manifests in a Git repository:

my-app/
├── deployment.yaml
├── service.yaml
└── route.yaml

Create an Argo CD Application

Define an Argo CD Application to deploy your manifests:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: my-app                        # Name of your application in Argo CD
  namespace: openshift-gitops         # Namespace where Argo CD is installed
spec:
  project: default                   # Argo CD project (use 'default' for simplicity)
  source:
    repoURL: https://github.com/yourorg/yourrepo  # Your Git repository URL
    targetRevision: HEAD             # Git branch/tag to deploy from
    path: my-app                     # Directory path in repo containing manifests
  destination:
    server: https://kubernetes.default.svc  # Target cluster (current cluster)
    namespace: my-app                # Target namespace for your application
  syncPolicy:
    syncOptions:
    - CreateNamespace=true           # Automatically create target namespace

Apply the Application:

oc apply -f argocd-app.yaml

Monitoring Applications

Argo CD UI

  1. Access Argo CD UI through the Route
  2. View application health and sync status
  3. See resource relationships in the application tree
  4. Compare desired state (Git) vs actual state (cluster)

Next Steps

Now that you can deploy with GitOps, explore managing configuration:

  • Secrets - Securely handle sensitive configuration
  • ConfigMaps - Manage application configuration

Additional Resources