Skip to content

Implement GitOps Workflow with Argo CD #73

@SelahattinSert

Description

@SelahattinSert

We currently manage our Kubernetes manifests by storing them in our Git repository under the k8s/ directory. However,
deployments are likely triggered manually or via CI scripts using kubectl apply.

To improve this, we will adopt a GitOps workflow using Argo CD, making Git the single source of truth for our
application's desired state.

Goal

  • Automate the deployment process by making Git the single source of truth.
  • Ensure that any change merged to the main branch is automatically and safely reflected in the Kubernetes cluster.
  • Increase security by removing the need for direct kubectl access for deployments.
  • Provide a clear audit trail and an easy rollback mechanism through Git history.

Task Overview

  • Create a dedicated namespace for Argo CD (e.g., argocd).
  • Install Argo CD into the cluster using the official manifests or Helm chart.
  • Configure repository access so Argo CD can read from our Git repository.
  • Implement the "App of Apps" pattern:
    • Create a new directory (k8s/argo-cd/) to hold the Argo CD Application manifests.
    • Define "child" Application resources for our existing components (app, logging, monitoring).
    • Create a "root" Application that manages all other applications.
  • Bootstrap Argo CD by manually applying the "root" application manifest once.
  • Verify the synchronization by making a test change in a manifest (e.g., update an image tag or replica count)
    and observing that Argo CD automatically applies it.
  • Update CI/CD pipelines to remove the old kubectl apply deployment steps. The pipeline's role will be to
    build and push the container image.
  • Update project documentation (README.md) to reflect the new GitOps deployment workflow.

Requirements

  • The state of the Kubernetes cluster must match the configuration defined in the k8s/ directory of the Git
    repository.
  • The camera-onboarding application, along with logging and monitoring stacks, must be managed by Argo CD and
    report a Synced and Healthy status.
  • Manual deployments via kubectl apply should be deprecated as the standard workflow.

Notes

  • The initial setup should be performed on a test/staging cluster, not directly in production.
  • The "App of Apps" pattern is recommended to manage multiple components declaratively.
  • Argo CD's UI can be exposed via kubectl port-forward for initial setup and verification.
  • Remember to secure Argo CD by changing the default admin password after installation.

Deliverables

  • Argo CD is deployed and configured in the cluster.
  • All applications (app, logging, monitoring) are managed by Argo CD.
  • A change pushed to the k8s/ directory in the main branch results in an automatic update on the cluster.
  • Updated documentation outlining the new deployment process.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions