Skip to content
All essays
ArchitectureMarch 27, 202614 min

GitOps: Operations by Pull Request

Master GitOps and transform your operations workflow with Git as the single source of truth

Ü
Ümit Uz
Mobile & Full Stack Developer

GitOps represents a paradigm shift in how we manage infrastructure and deployments. By using Git as the single source of truth for both application code and infrastructure, GitOps enables teams to manage operations through the same workflows they use for application development.

What is GitOps?

GitOps is an operational model that uses Git as the single source of truth for infrastructure and application deployments. All changes are made through pull requests, providing audit trails, rollbacks, and approval workflows.

Core Principles

  1. 1Declarative Specification: Systems are described in declarative configuration
  2. 2Versioned Infrastructure: All configuration is stored in Git
  3. 3Automated Synchronization: Automated agents pull changes from Git
  4. 4Continuous Reconciliation: Systems continuously converge to desired state

Benefits

  • Visibility: All changes tracked in Git history
  • Recoverability: Easy rollback to any previous state
  • Consistency: Same process for apps and infrastructure
  • Productivity: Faster deployments with fewer errors

Implementation

Kubernetes with ArgoCD

yaml
# argocd/application.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: myapp
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://github.com/myorg/myapp.git
    targetRevision: main
    path: k8s/manifests
  destination:
    server: https://kubernetes.default.svc
    namespace: production
  syncPolicy:
    automated:
      prune: true
      selfHeal: true

Flux CD

yaml
# flux/helmrelease.yaml
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: myapp
  namespace: production
spec:
  interval: 5m
  chart:
    spec:
      chart: myapp
      sourceRef:
        kind: HelmRepository
        name: mychart-repo
  values:
    image:
      tag: "1.2.3"
    replicas: 3

Best Practices

  1. 1Separate environments by Git branches
  2. 2Use automated validation in CI/CD
  3. 3Implement proper RBAC
  4. 4Monitor drift and sync status
  5. 5Use secrets management solutions

Conclusion

GitOps transforms operations into a pull-based model where Git drives everything. Start with a single application, expand to infrastructure, and enjoy the benefits of Git-based operations.

Enjoyed this essay? Share it.

Related essays

Next essay
Next.js API Routes: Building Serverless Functions