Skip to content

ArgoCD

Install ArgoCD

kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

Get initial admin password

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

Boostrap the ArgoCD configuration using a Git repository

The manifests for the ArgoCD configuration are stored in a git repository. The repository in this example is located at https://gitlab.simoncor.net/kaas/argocd.git and the path within the repository is argocd/.

In this subfolder we have an ArgoCD Application manifest which bootstraps the ArgoCD configuration. We also have other manifests for configuring ArgoCD ingress configuration and applications.

kubectl apply -f - <<EOF
---
apiVersion: "argoproj.io/v1alpha1"
kind: "Application"
metadata:
  name: "argocd"
  namespace: "argocd"
spec:
  project: "default"
  source:
    repoURL: "https://gitlab.simoncor.net/kaas/argocd.git"
    path: "argocd/"
    targetRevision: "main"
    directory:
      recurse: true
      jsonnet: {}
  destination:
    server: "https://kubernetes.default.svc"
    namespace: "argocd"
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
      - "CreateNamespace=true"
EOF

Update ArgoCD

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

ArgoCD Applications

This is an example of an ArgoCD Application manifest which deploys this MkDocs application.

---
apiVersion: "argoproj.io/v1alpha1"
kind: "Application"
metadata:
  name: "docs-simoncor-net"
  namespace: "argocd"
spec:
  project: "default"
  source:
    repoURL: "https://gitlab.simoncor.net/kaas/docs-simoncor-net.git"
    path: "manifests/"
    targetRevision: "main"
  destination:
    server: "https://kubernetes.default.svc"
    namespace: "docs-simoncor-net"
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
      enabled: true
    syncOptions:
      - "CreateNamespace=true"