Skip to content

alexclear/not-so-awesome-gitops-infra

Repository files navigation

Deprecation warning

This repo is in the middle of transition from Argo to Flux at the moment. I will rewrite this README eventually to reflect recent changes.

Installation

Follow these steps to install ArgoCD and bootstrap the infrastructure:

  1. kubectl create ns argocd
  2. helm upgrade --install argocd argo/argo-cd -n argocd --version=7.8.26 -f ./applications-helm/argocd/argocd/values.yaml
  3. kubectl apply -f main-application.yaml -n argocd
  4. kubectl get secrets argocd-initial-admin-secret -n argocd -o yaml to get the base64-encoded admin ArgoCD UI password
  5. kubectl port-forward svc/argocd-server -n argocd 8443:80 to forward the ArgoCD port, open http://127.0.0.1:8443 locally and login there then, ignore certificate errors ("thisisunsafe" trick in Chrome browser: when you see the certificate error page, type "thisisunsafe" to proceed)
  6. Open Settings -> Repositories in the ArgoCD UI and connect your git repo manually (you typically need to provide just "Repository URL" and "SSH private key data")
  7. You won't be able to add all applications at once because monitoring CRDs are not installed separately. Turn off monitoring for ArgoCD, Rook operator, Rook Ceph cluster, and Nginx ingress controller until you populate the "monitoring" namespace with the Prometheus stack and its CRDs

Infrastructure Repository Structure

This repository contains Kubernetes infrastructure configurations managed by ArgoCD. The structure follows GitOps principles where changes to this repository automatically synchronize with the target cluster.

Core Components

Main Application

ApplicationSets

  1. Helm-based Applications

  2. Raw Manifest Applications

Directory Structure

applications-helm/

  • Each top-level folder represents a Kubernetes namespace
    • Example: applications-helm/argocd/
  • Each namespace folder contains subfolders representing ArgoCD applications
    • Example: applications-helm/argocd/argocd/ contains:
      • helmfile.yaml - Helmfile configuration
      • values.yaml - Helm values

applications-raw/

  • Each top-level folder represents a Kubernetes namespace
    • Example: applications-raw/argocd/
  • Each namespace folder contains subfolders representing ArgoCD applications
    • Example: applications-raw/argocd/argocd-secrets/ contains raw Kubernetes manifest YAML files

Important Note

  • Application Name Uniqueness: Each ArgoCD application name (the 2nd level subfolders under applications-helm and applications-raw) must be globally unique across the entire cluster. Duplicate application names will cause conflicts in ArgoCD and prevent proper synchronization.

    Practical Example:

    • ❌ Invalid structure (duplicate application names):
      applications-raw/
      ├── application/
      │   └── network-policies/  # Application name: network-policies
      │       └── policy1.yaml
      └── pg-application/
          └── network-policies/  # Application name: network-policies (DUPLICATE!)
              └── policy2.yaml
      
    • ✅ Valid structure (unique application names):
      applications-raw/
      ├── application/
      │   └── network-policies-application/  # Application name: network-policies-application
      │       └── policy1.yaml
      └── pg-application/
          └── network-policies-pg-application/  # Application name: network-policies-pg-application
              └── policy2.yaml
      

Workflow

  1. ArgoCD monitors this repository
  2. main-application.yaml triggers the two ApplicationSets
  3. ApplicationSets scan their respective directories:
    • applications-helm/ → Helmfile-based apps
    • applications-raw/ → Raw manifest apps
  4. Applications are deployed to their respective namespaces in the target cluster

About

A practical GitOps example for fun and running my home cluster

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published