DevOps

GitOps: Complete Guide to Git-Based Operations

· Pavan Y N · gitops, kubernetes, devops, cicd

GitOps manages infrastructure and applications by storing their desired state in Git and letting software agents make the running system match it. Version control, code review, and automation then apply to operations the same way they apply to application code. EduGeek explains the GitOps principles, the two main Kubernetes tools (Argo CD and Flux), a working repository layout, a CI pipeline that feeds it, progressive delivery, secrets handling, and the problems teams hit most often.

The tool details reflect Argo CD 3.x (3.5 was the current release in October 2026) and Flux 2.9. Both projects have changed APIs and defaults since 2025, and the sections below call out the changes that break older manifests.

# What is GitOps?

GitOps is defined by the OpenGitOps project through four principles (version 1.0.0):

  1. •Declarative: a system managed by GitOps describes its target configuration in a declarative format.
  2. •Versioned and immutable: the target state is stored so that it cannot be altered in place, is versioned, and keeps a complete history.
  3. •Pulled automatically: software agents retrieve the target state from its source on their own.
  4. •Continuously reconciled: agents keep checking the live system's actual state and work to bring it in line with the target state.

The third principle is what separates GitOps from a CI pipeline that runs kubectl apply. In GitOps an agent inside the cluster pulls the change, so the CI system never needs credentials for the production cluster.

## GitOps compared with traditional operations

AspectTraditional opsGitOps
ConfigurationImperative scripts and manual changesDeclarative manifests
Source of truthWhatever is running in productionThe Git repository
DeploymentPushed by people or CI scriptsPulled and applied by an in-cluster agent
RollbackRe-run or reverse proceduresRevert a commit
Audit trailScattered logsGit history and pull request reviews
Access controlDirect cluster credentialsGit permissions, with cluster access held by the agent

# The GitOps workflow

code
┌─────────────┐
│  Developer  │
│  changes    │
└──────┬──────┘
       │
       ▼
┌─────────────┐
│ Git commit  │
│ and push    │
└──────┬──────┘
       │
       ▼
┌─────────────┐
│ CI pipeline │
│ build, test │
│ push image  │
└──────┬──────┘
       │
       ▼
┌─────────────┐
│ Update the  │
│ config repo │
└──────┬──────┘
       │
       ▼
┌─────────────┐
│ GitOps agent│
│ detects the │
│ change      │
└──────┬──────┘
       │
       ▼
┌─────────────┐
│ Apply to    │
│ the cluster │
└─────────────┘

## Repository structure

Option 1: a single repository

code
my-app/
├── src/                    # Application code
├── Dockerfile
├── k8s/                    # Kubernetes manifests
│   ├── base/
│   │   ├── deployment.yaml
│   │   ├── service.yaml
│   │   └── kustomization.yaml
│   └── overlays/
│       ├── dev/
│       ├── staging/
│       └── production/
└── .github/workflows/
    └── ci.yaml

Option 2: separate application and configuration repositories (recommended)

code
app-repo/                   # Application code
├── src/
├── Dockerfile
└── .github/workflows/
    └── ci.yaml

config-repo/                # Configuration
├── apps/
│   └── my-app/
│       ├── base/
│       └── overlays/
├── infrastructure/
│   ├── networking/
│   └── monitoring/
├── clusters/
│   ├── dev/
│   ├── staging/
│   └── production/
└── bootstrap/

The Argo CD best-practices guide recommends the separate configuration repository for five reasons: a config change such as a replica count does not trigger an application build, the history contains only configuration changes, applications built from several repositories do not fit into any one of them, developers can have commit rights to source without being able to push to production configuration, and pushing manifest updates to the source repository can cause endless build-and-commit loops.

# GitOps tools

## Argo CD

Argo CD is a declarative GitOps continuous delivery tool for Kubernetes.

Installation

code
kubectl create namespace argocd
kubectl apply -n argocd --server-side --force-conflicts \
  -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

# Reach the UI and API at https://localhost:8080
kubectl port-forward svc/argocd-server -n argocd 8080:443

# Read the initial admin password
argocd admin initial-password -n argocd

Server-side apply is required because some Argo CD custom resource definitions (CRDs), such as the one for ApplicationSet, exceed the 262 KB annotation limit of client-side kubectl apply, and --force-conflicts lets the apply take ownership of fields during upgrades. The stable branch moves with each release, so pin a release tag such as v3.5.5 for production. Delete the argocd-initial-admin-secret Secret after changing the admin password, because it serves no other purpose.

Application definition

code
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: my-app
  namespace: argocd
spec:
  project: default

  # Source repository
  source:
    repoURL: https://github.com/myorg/config-repo
    targetRevision: HEAD
    path: apps/my-app/overlays/production

    # Kustomize image override
    kustomize:
      images:
        - myapp=myregistry.azurecr.io/myapp:v1.2.3

  # Destination cluster
  destination:
    server: https://kubernetes.default.svc
    namespace: production

  # Sync policy
  syncPolicy:
    automated:
      prune: true        # Delete resources that were removed from Git
      selfHeal: true     # Revert manual changes made in the cluster
      allowEmpty: false  # Refuse to prune everything if the source renders empty

    syncOptions:
      - CreateNamespace=true
      - PruneLast=true

    retry:
      limit: 5
      backoff:
        duration: 5s
        factor: 2
        maxDuration: 3m

  # Let the autoscaler own the replica count
  ignoreDifferences:
    - group: apps
      kind: Deployment
      jsonPointers:
        - /spec/replicas

With automated sync enabled, Argo CD syncs when an application becomes OutOfSync and attempts one sync per unique combination of commit and parameters. selfHeal additionally reverts changes made directly in the cluster, and without prune resources deleted from Git stay in the cluster. Since Argo CD 3.0, resources are tracked with annotations by default instead of labels.

Command-line usage

code
# Log in (the default install uses a self-signed certificate)
argocd login localhost:8080 --insecure

# Create an application
argocd app create my-app \
  --repo https://github.com/myorg/config-repo \
  --path apps/my-app/overlays/production \
  --dest-server https://kubernetes.default.svc \
  --dest-namespace production

# Sync, inspect, and compare
argocd app sync my-app
argocd app get my-app
argocd app diff my-app
argocd app logs my-app

# List deployment history
argocd app history my-app

argocd app rollback exists, but Argo CD rejects it for an application with automated sync enabled ("Rollback cannot be performed against an application with automated sync enabled"). In a GitOps workflow the rollback is a git revert that the agent then applies.

## Flux

Flux is a set of Kubernetes controllers (a graduated project of the Cloud Native Computing Foundation, CNCF) that keep a cluster in sync with sources such as Git repositories, OCI (Open Container Initiative) artifacts, and Helm repositories. Its main custom resources are GitRepository (source), Kustomization (apply plain manifests or overlays), and HelmRelease (install Helm charts).

Installation and bootstrap

code
# Install the Flux CLI
curl -s https://fluxcd.io/install.sh | sudo bash

# Bootstrap into a repository owned by a GitHub organization
export GITHUB_TOKEN="<token>"
flux bootstrap github \
  --token-auth \
  --owner=myorg \
  --repository=config-repo \
  --branch=main \
  --path=clusters/production

Add --personal only when --owner is a personal GitHub account; for an organization, omit it. If GITHUB_TOKEN is not set, the command prompts for the token.

GitRepository source

code
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
  name: my-app
  namespace: flux-system
spec:
  interval: 1m
  url: https://github.com/myorg/config-repo
  ref:
    branch: main
  secretRef:
    name: github-credentials

Kustomization

code
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
  name: my-app
  namespace: flux-system
spec:
  interval: 5m
  path: ./apps/my-app/overlays/production
  prune: true
  sourceRef:
    kind: GitRepository
    name: my-app
  healthChecks:
    - apiVersion: apps/v1
      kind: Deployment
      name: my-app
      namespace: production
  timeout: 2m

Set wait: true instead of listing healthChecks to health-check every reconciled resource. The minimum interval is 60 seconds.

HelmRelease

code
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: my-app
  namespace: production
spec:
  interval: 5m
  chart:
    spec:
      chart: my-app
      version: '1.2.x'
      sourceRef:
        kind: HelmRepository
        name: my-charts
        namespace: flux-system
  values:
    replicaCount: 3
    image:
      repository: myregistry.azurecr.io/myapp
      tag: v1.2.3
    resources:
      limits:
        cpu: 500m
        memory: 512Mi

The HelmRelease API reached general availability as helm.toolkit.fluxcd.io/v2 in Flux 2.3. The older v2beta1 version was removed from the CRDs in Flux 2.7 and v2beta2 in Flux 2.8, so manifests that still use them stop applying after an upgrade. Find and migrate them with a search for helm.toolkit.fluxcd.io/v2beta. Flux 2.9 likewise removed image.toolkit.fluxcd.io/v1beta2 and notification.toolkit.fluxcd.io/v1beta2, so use v1 for image automation resources such as ImagePolicy.

Instead of a Helm repository, a HelmRelease can reference a chart stored in an OCI registry through chartRef and an OCIRepository source.

# Implementing GitOps

## Step 1: prepare the configuration repository

code
config-repo/
├── apps/
│   ├── frontend/
│   │   ├── base/
│   │   │   ├── deployment.yaml
│   │   │   ├── service.yaml
│   │   │   └── kustomization.yaml
│   │   └── overlays/
│   │       ├── dev/
│   │       ├── staging/
│   │       └── production/
│   └── backend/
│       └── ...
├── infrastructure/
│   ├── ingress-nginx/
│   ├── cert-manager/
│   └── monitoring/
└── clusters/
    ├── dev/
    ├── staging/
    └── production/

Base Deployment

code
# apps/frontend/base/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontend
spec:
  replicas: 2
  selector:
    matchLabels:
      app: frontend
  template:
    metadata:
      labels:
        app: frontend
    spec:
      containers:
        - name: frontend
          image: myregistry.azurecr.io/frontend:placeholder
          ports:
            - containerPort: 80
          env:
            - name: API_URL
              value: http://backend:8080
          resources:
            requests:
              cpu: 100m
              memory: 128Mi
            limits:
              cpu: 500m
              memory: 512Mi
          livenessProbe:
            httpGet:
              path: /health
              port: 80
            initialDelaySeconds: 30
            periodSeconds: 10
          readinessProbe:
            httpGet:
              path: /ready
              port: 80
            initialDelaySeconds: 5
            periodSeconds: 5

The base uses a placeholder tag on purpose. Each overlay pins a concrete, immutable tag, so the image that runs is always recorded in Git. Never point an overlay at latest.

code
# apps/frontend/base/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
  - deployment.yaml
  - service.yaml

Production overlay

code
# apps/frontend/overlays/production/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: production

resources:
  - ../../base

replicas:
  - name: frontend
    count: 5

images:
  - name: myregistry.azurecr.io/frontend
    newTag: sha-1a2b3c4

patches:
  - patch: |-
      - op: replace
        path: /spec/template/spec/containers/0/resources/limits/cpu
        value: 1000m
      - op: replace
        path: /spec/template/spec/containers/0/resources/limits/memory
        value: 1Gi
    target:
      kind: Deployment
      name: frontend

configMapGenerator:
  - name: frontend-config
    literals:
      - API_URL=https://api.production.example.com
      - LOG_LEVEL=info

Kustomize remote bases deserve the same discipline: the Argo CD guide warns that a remote base pointing at a branch head is an unstable target, so pin remote bases to a tag or commit SHA.

## Step 2: set up CI

The CI job builds the image, pushes it with an immutable tag, and then commits that tag to the configuration repository. The metadata action can emit several tags, and kustomize edit set image accepts only one, so this workflow generates a single immutable sha- tag and passes that.

code
name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

env:
  REGISTRY: myregistry.azurecr.io
  IMAGE_NAME: frontend

jobs:
  build-and-push:
    runs-on: ubuntu-latest
    permissions:
      contents: read

    outputs:
      image-tag: ${{ steps.meta.outputs.version }}

    steps:
      - name: Check out code
        uses: actions/checkout@v7

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v4

      - name: Log in to the registry
        if: github.event_name != 'pull_request'
        uses: docker/login-action@v4
        with:
          registry: ${{ env.REGISTRY }}
          username: ${{ secrets.REGISTRY_USERNAME }}
          password: ${{ secrets.REGISTRY_PASSWORD }}

      - name: Extract metadata
        id: meta
        uses: docker/metadata-action@v6
        with:
          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
          tags: |
            type=sha

      - name: Build and push
        uses: docker/build-push-action@v7
        with:
          context: .
          push: ${{ github.event_name != 'pull_request' }}
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          cache-from: type=gha
          cache-to: type=gha,mode=max

  update-manifest:
    needs: build-and-push
    if: github.event_name == 'push' && github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest

    steps:
      - name: Check out the config repo
        uses: actions/checkout@v7
        with:
          repository: myorg/config-repo
          token: ${{ secrets.CONFIG_REPO_TOKEN }}

      - name: Update the image tag
        working-directory: apps/frontend/overlays/production
        env:
          IMAGE_TAG: ${{ needs.build-and-push.outputs.image-tag }}
        run: |
          kustomize edit set image \
            "$REGISTRY/$IMAGE_NAME=$REGISTRY/$IMAGE_NAME:$IMAGE_TAG"

      - name: Commit and push
        env:
          IMAGE_TAG: ${{ needs.build-and-push.outputs.image-tag }}
        run: |
          git config user.name "github-actions[bot]"
          git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
          git add -A
          git diff --cached --quiet || {
            git commit -m "chore: deploy frontend $IMAGE_TAG"
            git push
          }

Pull requests build the image but do not push it, and only pushes to main reach the second job. The CONFIG_REPO_TOKEN secret should be a fine-grained token or GitHub App token limited to the configuration repository. The Ubuntu runner image includes Kustomize, so no install step is needed. For stronger guarantees, deploy by image digest instead of tag, because a digest cannot be re-pointed.

Flux can do the last step itself. Its image automation controllers (ImageRepository, ImagePolicy, and ImageUpdateAutomation in image.toolkit.fluxcd.io/v1) scan the registry and commit new tags to Git without a CI job writing to the configuration repository.

## Step 3: configure the GitOps agent

Argo CD app-of-apps pattern

A root Application watches a directory that contains child Application manifests. Keep the root outside the directory it watches so that it does not manage itself.

code
# bootstrap/production-apps.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: production-apps
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://github.com/myorg/config-repo
    targetRevision: HEAD
    path: clusters/production/apps
  destination:
    server: https://kubernetes.default.svc
    namespace: argocd
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
code
# clusters/production/apps/frontend.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: frontend
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://github.com/myorg/config-repo
    targetRevision: HEAD
    path: apps/frontend/overlays/production
  destination:
    server: https://kubernetes.default.svc
    namespace: production
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
      - CreateNamespace=true

# Advanced GitOps patterns

## Progressive delivery

Flagger, a progressive delivery tool in the Flux family of projects, automates canary releases. It shifts traffic in steps and checks metrics at each step. Traffic routing needs a supported service mesh (Gateway API, Istio, Linkerd, or Kuma) or ingress controller (such as NGINX, Traefik, or Contour), and the built-in success-rate and latency metrics come from that provider's metrics.

code
apiVersion: flagger.app/v1beta1
kind: Canary
metadata:
  name: frontend
  namespace: production
spec:
  targetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: frontend

  service:
    port: 80

  analysis:
    interval: 1m
    threshold: 5
    maxWeight: 50
    stepWeight: 10

    metrics:
      - name: request-success-rate
        thresholdRange:
          min: 99
        interval: 1m

      - name: request-duration
        thresholdRange:
          max: 500
        interval: 1m

    webhooks:
      - name: load-test
        type: rollout
        url: http://flagger-loadtester/
        timeout: 5s
        metadata:
          cmd: "hey -z 1m -q 10 -c 2 http://frontend-canary/"

threshold is the number of failed metric checks before rollback, stepWeight and maxWeight are percentages, and a rollout webhook runs on every analysis iteration before the metric checks. The sum of all rollout webhook timeouts should stay below the analysis interval.

## Multi-cluster management

An Argo CD ApplicationSet generates one Application per element of a generator. Enable Go templates and make missing keys an error so that a typo fails loudly instead of rendering an empty value.

code
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: frontend-multicluster
  namespace: argocd
spec:
  goTemplate: true
  goTemplateOptions: ["missingkey=error"]
  generators:
    - list:
        elements:
          - cluster: dev
            url: https://dev-cluster.example.com
            namespace: development
          - cluster: staging
            url: https://staging-cluster.example.com
            namespace: staging
          - cluster: production
            url: https://prod-cluster.example.com
            namespace: production

  template:
    metadata:
      name: 'frontend-{{.cluster}}'
    spec:
      project: default
      source:
        repoURL: https://github.com/myorg/config-repo
        targetRevision: HEAD
        path: 'apps/frontend/overlays/{{.cluster}}'
      destination:
        server: '{{.url}}'
        namespace: '{{.namespace}}'
      syncPolicy:
        automated:
          prune: true
          selfHeal: true

With goTemplate: true, parameters are written {{.cluster}}, not {{cluster}}. The overlay directory names (dev, staging, production) must match the cluster values.

## Secret management

A Git repository must never contain plaintext secrets, and a Kubernetes Secret manifest with base64 values counts as plaintext. Two patterns keep secrets out of Git.

Sealed Secrets encrypt a Secret with the controller's public key so that only the controller in the cluster can decrypt it, which makes the encrypted SealedSecret safe to commit.

code
# Install the controller
helm repo add sealed-secrets https://bitnami.github.io/sealed-secrets
helm install sealed-secrets -n kube-system \
  --set-string fullnameOverride=sealed-secrets-controller \
  sealed-secrets/sealed-secrets

# Seal a secret and commit only the sealed result
kubectl create secret generic my-secret \
  --namespace production \
  --dry-run=client \
  --from-file=password=./password.txt \
  -o yaml | kubeseal --format yaml > sealed-secret.yaml

git add sealed-secret.yaml
git commit -m "feat: add sealed secret for my-app"
git push

A sealed secret is bound to the namespace and name it was created for, by default. The fullnameOverride lets the kubeseal CLI find the controller without extra flags.

External Secrets Operator keeps the secret in an external store and syncs it into the cluster, so Git holds only a reference.

code
helm repo add external-secrets https://charts.external-secrets.io
helm install external-secrets external-secrets/external-secrets \
  -n external-secrets --create-namespace
code
apiVersion: external-secrets.io/v1
kind: SecretStore
metadata:
  name: azure-keyvault
  namespace: production
spec:
  provider:
    azurekv:
      authType: WorkloadIdentity
      vaultUrl: "https://my-vault.vault.azure.net"
      serviceAccountRef:
        name: workload-identity-sa
---
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
  name: app-secrets
  namespace: production
spec:
  refreshInterval: 1h
  secretStoreRef:
    name: azure-keyvault
    kind: SecretStore
  target:
    name: app-secrets
    creationPolicy: Owner
  data:
    - secretKey: database-password
      remoteRef:
        key: prod-db-password
    - secretKey: api-key
      remoteRef:
        key: prod-api-key

The external-secrets.io/v1 API is the one shown in the current documentation. Workload identity avoids storing a client secret in the cluster; the Azure Key Vault provider page also documents service principal authentication.

# Operating GitOps in practice

These practices follow the Argo CD, Flux, and OpenGitOps documentation:

  • →Separate configuration from source code, as described above.
  • →Keep automation-managed fields out of Git. Fields controlled by an autoscaler, such as spec.replicas under a HorizontalPodAutoscaler, should be ignored with ignoreDifferences or omitted from manifests.
  • →Make revisions immutable. Pin images by immutable tag or digest and pin remote Kustomize or Helm bases to tags or commits.
  • →Roll back with Git. A reverted commit is reviewed, recorded, and reconciled like any other change.
  • →Monitor the agents. Both Argo CD and Flux expose Prometheus metrics; see the Prometheus guide for collection and alerting.

# Common issues and troubleshooting

## Application out of sync

Symptoms: the UI shows OutOfSync, and live resources differ from Git.

code
# Check status and see the differences
argocd app get my-app
argocd app diff my-app

# Inspect the Application resource itself
kubectl get application my-app -n argocd -o yaml
code
# Sync manually
argocd app sync my-app

# Preview a sync without changing the cluster
argocd app sync my-app --dry-run

# Also delete resources that are no longer in Git
argocd app sync my-app --prune

--force performs a force apply, which can delete and recreate resources, so reserve it for objects that cannot be patched in place. It does not mean "ignore differences".

## Image pull errors

Symptoms: pods stuck in ImagePullBackOff.

Create the registry credentials as a Secret, but seal them or sync them from a secret store before committing; a kubernetes.io/dockerconfigjson Secret with base64 content in Git exposes the credentials.

code
kubectl create secret docker-registry registry-credentials \
  --namespace production \
  --docker-server=myregistry.azurecr.io \
  --docker-username="$REGISTRY_USERNAME" \
  --docker-password="$REGISTRY_PASSWORD" \
  --dry-run=client -o yaml | kubeseal --format yaml > registry-credentials-sealed.yaml
code
# Reference the secret in the pod template
spec:
  template:
    spec:
      imagePullSecrets:
        - name: registry-credentials

## Sync loops

Symptoms: the application keeps syncing, and resources are updated again and again.

A controller in the cluster (an autoscaler, an admission webhook, an operator) changes a field that Git also defines, and Argo CD reverts it. Identify the field with argocd app diff my-app, then either stop declaring it in Git or ignore it.

code
apiVersion: argoproj.io/v1alpha1
kind: Application
spec:
  ignoreDifferences:
    - group: apps
      kind: Deployment
      jsonPointers:
        - /spec/replicas

For fields owned by a whole controller, managedFieldsManagers can ignore everything a named field manager wrote.

## Slow or late syncs

Symptoms: a merged change takes minutes to appear in the cluster.

Argo CD polls Git on the timeout.reconciliation interval, which defaults to 120 seconds plus up to 60 seconds of jitter, so a change can take up to three minutes to be noticed. Configure a Git webhook to refresh immediately. Resources that depend on one another, such as a CRD and the custom resources that use it, can be ordered with sync waves, where lower numbers apply first and the default wave is 0.

code
metadata:
  annotations:
    argocd.argoproj.io/sync-wave: "-1"

# Best practices

## Repository organization

  • →Separate application code from configuration.
  • →Use environment-specific overlays.
  • →Keep base manifests free of environment details.

## Security

  • →Keep secrets out of Git with Sealed Secrets or External Secrets Operator.
  • →Limit who can push to the configuration repository and who can sync in Argo CD (Argo CD 3.0 made update and delete permissions on an application separate from permissions on its managed resources).
  • →Give CI credentials to the configuration repository only, never to the cluster.

## Deployment strategy

  • →Use progressive delivery for user-facing services.
  • →Define health checks so the agent can tell when a rollout has finished.
  • →Plan rollbacks as Git reverts.

## Team workflow

  • →Require pull requests and review for configuration changes.
  • →Validate manifests in CI before they merge.
  • →Connect the workflow to your pipeline tooling; the Jenkins CI/CD guide shows a CI server that builds the image, and Git version control mastery covers the branching and review practices GitOps depends on.

# Key takeaways

  • →GitOps rests on four OpenGitOps principles: declarative, versioned and immutable, pulled automatically, and continuously reconciled.
  • →Keep application source and deployment configuration in separate repositories so that config changes do not trigger builds and developers do not automatically gain production write access.
  • →Install Argo CD with --server-side because its CRDs exceed the client-side apply annotation limit, and roll back by reverting a commit because rollback is rejected while automated sync is enabled.
  • →Use helm.toolkit.fluxcd.io/v2 for Flux HelmRelease resources, since v2beta1 and v2beta2 have been removed from the CRDs.
  • →Commit immutable image tags or digests to the configuration repository, and never commit plaintext or base64-encoded Secrets.
  • →Write ApplicationSet templates with goTemplate: true and missingkey=error, and use {{.value}} syntax.
  • →Fix sync loops by finding the field a cluster controller changes with argocd app diff, then ignore it with ignoreDifferences or stop declaring it in Git.

# Further reading

Test yourself: GitOps: Git-Based Operations assessment

All posts