Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

🏠 Back to Blog

Installation and Configuration

Install methods

  • Namespace is argocd by convention

Manifests (non-HA)

  • single replica of everything, dev/test
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
kubectl get pods -n argocd
  • pods: argocd-server, argocd-repo-server, argocd-application-controller, argocd-applicationset-controller, argocd-redis, argocd-dex-server, argocd-notifications-controller

Manifests (HA)

  • for production, multiple replicas, Redis HA (sentinel + haproxy)
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/ha/install.yaml
  • install.yaml / ha/install.yaml = cluster-wide (can manage external clusters + any namespace)
  • namespace-install.yaml = namespace-scoped only (needs clusters registered with explicit namespaces)

Helm

  • most flexible, community chart in argo-helm
helm repo add argo https://argoproj.github.io/argo-helm
helm install argocd argo/argo-cd -n argocd --create-namespace -f values.yaml
helm upgrade argocd argo/argo-cd -n argocd -f values.yaml
helm show values argo/argo-cd > default-values.yaml
# values.yaml
server:
  replicas: 2
  ingress:
    enabled: true
    ingressClassName: nginx
    hostname: argocd.example.com
controller:
  replicas: 1   # sharding needed to scale controller
repoServer:
  replicas: 2
redis-ha:
  enabled: true

Operator

  • Argo CD Operator (OLM) manages an ArgoCD CR, handy on OpenShift
apiVersion: argoproj.io/v1beta1
kind: ArgoCD
metadata:
  name: argocd
  namespace: argocd
spec:
  server:
    route:
      enabled: true
  ha:
    enabled: true

Initial setup

Admin password

argocd admin initial-password -n argocd
# or
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
  • change it, then delete argocd-initial-admin-secret
argocd account update-password

Access

  • port-forward for quick access, UI at https://localhost:8080, user admin
    kubectl port-forward svc/argocd-server -n argocd 8080:443
    
  • LoadBalancer
    kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
    
  • Ingress: argocd-server serves gRPC + HTTPS on the same port, so either ssl-passthrough or run with server.insecure and terminate TLS at the ingress
    metadata:
      annotations:
        nginx.ingress.kubernetes.io/ssl-passthrough: "true"
        nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
    spec:
      ingressClassName: nginx
      rules:
      - host: argocd.example.com
        http:
          paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: argocd-server
                port:
                  name: https
    
  • OpenShift: Route with tls.termination: passthrough

CLI

brew install argocd                 # macOS
curl -sSL -o argocd https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
sudo install -m 555 argocd /usr/local/bin/argocd   # linux

argocd version
argocd login <server> --username admin --password <pw>
argocd login <server> --sso
argocd login <server> --auth-token <token>
argocd login <server> --insecure    # skip TLS verify, not for prod
argocd account get-user-info
argocd context                      # list/switch contexts
  • CLI config lives in ~/.config/argocd/config

Config objects

  • all live in the argocd namespace, all declarative
  • argocd-cm - main config
    • url, admin.enabled, users.anonymous.enabled, accounts.<name>
    • timeout.reconciliation (180s), timeout.hard.reconciliation
    • resource.exclusions, resource.customizations.* (health, ignoreDifferences, actions)
    • application.instanceLabelKey, application.resourceTrackingMethod (label, annotation, annotation+label)
    • dex.config, oidc.config
  • argocd-cmd-params-cm - component flags (preferred over editing deployment args)
    • server.insecure: "true" for TLS termination at ingress
    • controller.status.processors, controller.operation.processors
    • controller.self.heal.timeout.seconds
    • reposerver.parallelism.limit
    • application.namespaces
  • argocd-rbac-cm - see rbac-security
  • argocd-secret - admin password hash, server signing key, webhook secrets, SSO client secrets
  • argocd-notifications-cm / argocd-notifications-secret - services, templates, triggers
  • argocd-ssh-known-hosts-cm, argocd-tls-certs-cm, argocd-gpg-keys-cm
  • repos and clusters are Secrets with label argocd.argoproj.io/secret-type (see application-management, multi-cluster)
    • the repositories key in argocd-cm is deprecated

Reconciliation

  • the repo server caches manifests, reconciliation refresh interval is timeout.reconciliation
  • also set up a git webhook to /api/webhook so changes are picked up immediately (see rbac-security)

Notifications

# argocd-notifications-cm
data:
  service.slack: |
    token: $slack-token
  template.app-deployed: |
    message: Application {{.app.metadata.name}} is now running a new version.
  trigger.on-deployed: |
    - when: app.status.operationState.phase in ['Succeeded']
      send: [app-deployed]
  • subscribe an app with an annotation:
    notifications.argoproj.io/subscribe.on-deployed.slack: my-channel
    

Misc

  • orphaned resources monitoring is configured per-project (spec.orphanedResources.warn)
  • statusbadge.enabled: "true" for status badges
  • UI banner: ui.bannercontent, ui.bannerurl