Geavanceerd
Zoeken inInstallatiegidsen
Zo zoek je
  • Plak een foutmelding tussen aanhalingstekens, bijv. "permission denied", om de oplossingstabel te vinden.
  • Kies een gebied en een deel van de gids (installeren, eerste instellingen, dagelijks gebruik, beveiliging, oplossingen) om direct naar de juiste stap te gaan.
  • "twee woorden" vindt precies die zin.
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken
Probeer:

Gids 30Argo CD · Git and CI/CD

Install and set up Argo CD (GitOps)

Argo CD deploys to Kubernetes the GitOps way: Git holds the wanted state (YAML, Helm or Kustomize), and Argo CD keeps the cluster equal to Git — it shows what is different, syncs it, and can fix manual changes by itself. Rollback is a Git revert. This guide installs Argo CD in a cluster, installs the CLI, logs in safely, connects a repository, creates the first Application with auto-sync, and covers projects, RBAC and fixes.

  • 10 Lessen
  • 7 Commando's

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

$ als gewone gebruiker# als root (of met sudo)

30.1

Know it before you install

An Application says: "take this path in this Git repository and deploy it to this cluster and namespace". Argo CD compares Git with the cluster all the time: Synced / OutOfSync (is the cluster equal to Git?) and Healthy / Progressing / Degraded (do the Pods work?).

ItemValue
Runsin the cluster, namespace argocd
Partsargocd-server (UI/API), argocd-repo-server (reads Git), argocd-application-controller (compares and syncs), Redis, Dex (SSO)
CLIargocd
SettingsConfigMaps argocd-cm, argocd-rbac-cm, argocd-cmd-params-cm
First passwordSecret argocd-initial-admin-secret
ObjectsApplication, ApplicationSet, AppProject (CRDs)

What you need: a Kubernetes cluster with kubectl access (cluster-admin for the install), and a Git repository with your Kubernetes YAML or charts.

30.2

Install Argo CD in the cluster

The official manifest installs everything. Pin a version in production (replace stable with a tag like v3.1.8):

kubectl create namespace argocd
kubectl apply -n argocd --server-side --force-conflicts -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
kubectl -n argocd rollout status deploy/argocd-server
kubectl -n argocd get pods

Or with Helm: helm repo add argo https://argoproj.github.io/argo-helm and helm upgrade --install argocd argo/argo-cd -n argocd --create-namespace --version ….

30.3

Install the CLI (RHEL and Ubuntu)

curl -fsSL -o argocd https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
install -m 0755 argocd /usr/local/bin/argocd
argocd version --client

30.4

First login and the settings to make first

Reach the UI with a port-forward (later: an Ingress with TLS), read the first password, log in, change it:

kubectl -n argocd port-forward svc/argocd-server 8080:443
argocd admin initial-password -n argocd
argocd login localhost:8080 --username admin --insecure
argocd account update-password
kubectl -n argocd delete secret argocd-initial-admin-secret

(--insecure only for the port-forward with the self-signed certificate.) Then:

SettingWhy
New admin password, delete the initial secretThe first password is stored in the cluster in clear text (base64).
SSO (OIDC: Entra ID, Google, GitLab, Keycloak) in argocd-cmEach person logs in as themselves; one place to remove access.
admin.enabled: "false" after SSO worksNo shared admin account.
RBAC in argocd-rbac-cm (policy.default: role:readonly)Read-only for everyone, deploy rights only for the right teams.
An Ingress with TLS for argocd.example.comThe UI and CLI over HTTPS without port-forward.
AppProjects per teamLimit which repos, clusters and namespaces each team may use.

30.5

Connect a repository and create an Application

Use a read-only deploy key for the Git repository:

ssh-keygen -t ed25519 -f ~/.ssh/argocd-deploy -N '' -C argocd
argocd repo add git@github.com:ORG/deploy.git --ssh-private-key-path ~/.ssh/argocd-deploy
argocd repo list

Write the Application as YAML and keep it in Git too:

apps/shop.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: shop
  namespace: argocd
spec:
  project: default
  source:
    repoURL: git@github.com:ORG/deploy.git
    targetRevision: main
    path: shop/overlays/prod
  destination:
    server: https://kubernetes.default.svc
    namespace: shop
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
      - CreateNamespace=true
kubectl apply -f apps/shop.yaml
argocd app get shop
argocd app wait shop --health --timeout 300
OptionMeaning
automatedSync by itself when Git changes.
prune: trueDelete objects that were removed from Git.
selfHeal: trueUndo manual changes in the cluster (kubectl edit is reverted).
CreateNamespace=trueMake the target namespace if it does not exist.

30.6

Daily use: the commands and the real uses

argocd app list
argocd app get shop
argocd app diff shop
argocd app sync shop
argocd app history shop
argocd app rollback shop 4
argocd app logs shop --tail 50
argocd proj list
argocd cluster list

With selfHeal, a rollback in Argo CD is undone at the next sync — the real rollback is **git revert** of the bad commit.

Real uses at work:

  • Every environment (dev, test, prod) is a folder or branch in Git; promotion is a pull request.
  • App of apps / ApplicationSet: one Application creates many (all add-ons, every cluster, every team).
  • Audit: who changed what and when is the Git history; drift shows in the UI at once.

30.7

Make it safe

Security checklist:

  • Change the first password, delete argocd-initial-admin-secret, use SSO, then turn the admin user off.
  • RBAC: read-only default; AppProjects limit repos, clusters, namespaces and cluster-scoped kinds.
  • Read-only deploy keys for Git; no secrets in plain YAML — use Sealed Secrets, SOPS or External Secrets.
  • The UI only over HTTPS; not public unless behind SSO.
  • Argo CD can change everything in the cluster: protect the argocd namespace and update Argo CD often (security releases).
  • Branch protection on the deploy repository — Git is your production access now.

30.8

Update and remove

Read the upgrade notes for your version jump, then apply the new manifest (or helm upgrade):

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

Before removing Argo CD, delete or orphan the Applications on purpose — deleting an Application with the resources-finalizer also deletes its workloads.

30.9

Fix common problems

ProblemCauseFix
ComparisonError: … repository not accessibleWrong URL or deploy key.argocd repo list; add the key again; check the known hosts.
App always OutOfSync on the same fieldA controller or webhook changes the object after sync.Add ignoreDifferences for that field, or fix the YAML.
App stays ProgressingPods do not become ready.argocd app get APP → resources; kubectl describe and logs of the Pods.
the server could not find the requested resource / CRD errorsCRDs are synced after the objects that use them.Sync waves (argocd.argoproj.io/sync-wave), or install CRDs first.
permission denied in the CLI or UIRBAC policy.Check argocd-rbac-cm; argocd account can-i sync applications '*/shop'.
A manual hotfix disappearsselfHeal: true reverted it (as designed).Make the change in Git.
metadata.annotations: Too long on applyBig CRDs with client-side apply.Use --server-side --force-conflicts (as above).

30.10

Next steps

1With selfHeal: true, someone runs kubectl scale by hand. What happens?

Argo CD sees the drift and sets the cluster back to what Git says.

2What is the real rollback in a GitOps setup?

git revert of the bad commit — Argo CD then deploys the old state.

Alle commando's in dit hoofdstuk