ArgoCD — GitOps Controller

 
If you building a Kubernetes homelab, one of the first things you will want is a place to store your YAML files, Helm values, and scripts and we deployed Forgejo. This post covers deploying ArgoCD and It watches our Git repo in our Forgejo and ensures our cluster always matches what’s declared there. If someone makes a manual change, ArgoCD drifts it back. Sound familiar in vKS?

Install Argo in GitOps namespace

helm repo add argo https://argoproj.github.io/argo-helm
helm install my-argo-cd argo/argo-cd --version 9.4.17 \
  --namespace gitops \
  --create-namespace

Expose the UI — Manual NodePort Service

kubectl apply -f argocd-ui-svc.yaml

apiVersion: v1
kind: Service
metadata:
  name: argocd-ui
  namespace: gitops
spec:
  type: NodePort
  selector:
    app.kubernetes.io/name: argocd-server
  ports:
    - name: http
      port: 80
      targetPort: 8080
      nodePort: 30074

Get Initial Admin Password

kubectl get secret argocd-initial-admin-secret -n gitops -o jsonpath='{.data.password}' | base64 -d

Connect ArgoCD to Forgejo

ArgoCD connects to Forgejo using the Kubernetes internal service DNS

Repository URL Format

http://my-forgejo-http.git.svc.cluster.local:3000/awk/homelab.git

Breakdown:

  • my-forgejo-http — Forgejo service name
  • git — namespace
  • svc.cluster.local — Kubernetes internal DNS suffix
  • 3000 — container port (not the NodePort 30040)
  • /awk/homelab.git — your repo path

Steps in ArgoCD UI

  • Settings → Repositories → Connect Repo
  • Connection method: VIA HTTPS
  • Type: git
  • Repository URL: http://my-forgejo-http.git.svc.cluster.local:3000/awk/homelab.git
  • Enter Forgejo username and password
  • Click Connect

The GitOps Loop

ArgoCD compares the desired state in Git against the live state in the cluster. When they differ it shows OutOfSync. Clicking Sync applies the Git state to the cluster.

First Application — technitium-dns

FieldValue
Application Nametechnitium-dns
Projectdefault
Repository URLhttp://my-forgejo-http.git.svc.cluster.local:3000/awk/homelab.git
Revisionmain
Pathdns
Cluster URLhttps://kubernetes.default.svc
Namespacedns

GitOps Cycle

  • Edit YAML file locally
  • git add, git commit, git push to Forgejo
  • ArgoCD shows OutOfSync after Refresh
  • Click Sync — ArgoCD runs kubectl apply
  • Cluster matches Git state
(Visited 6 times, 1 visits today)

By Ash Thomas

Ash Thomas is a seasoned IT professional with extensive experience as a technical expert, complemented by a keen interest in blockchain technology.