Argo CD

Argo CD

Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. This is helpfull because all the kubernetes deployments can be declared inside Git repositories and argo will deploy everthing from these repos to the cluster. Therefore almost nothing needs to executed manually and git acts as a single point of truth.

Deploying Argo CD with Helm

In this case argo will be deployed with helm and the following values:

global:
  domain: argocd.westfall.thorados.de
configs:
  params:
    server.insecure: true
server:
  ingress:
    enabled: true
    ingressClassName: cilium
    annotations:
      ingress.cilium.io/loadbalancer-mode: shared
      ingress.cilium.io/websocket: enabled
    https: false

For now there is no way of handling certificates in the cluster so everything for https gets disabled. Argo will be deployed as follows:

helm repo add argo https://argoproj.github.io/argo-helm
helm upgrade \
    --install argo-cd argo/argo-cd \
    -f argo-cd-values.yaml \
    --namespace argocd \
    --create-namespace

Accessing the webinterface

During the deployment a secret gets created which is holding the admin password for the webinterface. It can be retrived with kubectl:

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

After that we can go to the domain specificed inside the values, asuming a DNS record was created and login with the admin and the password.

To deploy resources from git we first need to add a repository. This is done under Settings –> Repositories. There are multiple ways of structuring the repository and you can use classic deployments, kustomize and helm for the resources. In this example all deployments are in a single repository:

argocd
    applications
        longhorn-helm.yaml
        nginx.yaml
clusterapps
    longhorn-helm-single-node
        Chart.yaml
        values.yaml
    nginx
        deployment.yaml

For Longhorn the argo application yaml can look as follows. Likely there is a better way which hasn’t the argo app deployment inside the same repository but it works and this is what count for now.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: longhorn-helm
  namespace: argocd
spec:
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
      - CreateNamespace=true
  project: default
  source:
    repoURL: git@github.com:thorados/argocd.git
    targetRevision: HEAD
    path: clusterapps/longhorn-helm-single-node
    helm:
      valueFiles:
      - values.yaml
  destination:
    server: https://kubernetes.default.svc
    namespace: longhorn-system

Basically the argo applications references the same git repository where it’s storaged but we tell argo to look inside the clusterapps directory under longhorn-helm-single-node where the Chart.yaml and values.yaml live.

Inside the Chart.yaml we tell argo where to look for the longhorn helm chart:

apiVersion: v2
name: longhorn-wrapper
description: A wrapper chart to deploy Longhorn with custom values
type: application
version: 0.1.0
appVersion: 1.9.1

dependencies:
  - name: longhorn
    version: 1.9.1
    repository: https://charts.longhorn.io/

And inside the values.yaml the usual helm values are declared:

longhorn:
  preUpgradeChecker:
    jobEnabled: false
  service:
    ui:
      type: ClusterIP
  ingress:
    enabled: true
    ingressClassName: cilium
    host: longhorn.westfall.thorados.de
    tls: false
    path: "/"
    pathType: Prefix
    annotations:
      ingress.cilium.io/loadbalancer-mode: shared
      ingress.cilium.io/websocket: enabled
  longhornUI:
    replicas: 1
  persistence:
    defaultClassReplicaCount: 1
    reclaimPolicy: Retain
  csi:
    attacherReplicaCount: 1
    provisionerReplicaCount: 1
    resizerReplicaCount: 1
    snapshotterReplicaCount: 1
  defaultSettings:
    defaultReplicaCount: 1

One important value is the preUpgradeChecker which has to be disabled otherwise argo will never finish the deployment.

Sources