Lockdown Mode (Namespace-Scoped Argo CD)🔗
By default, Argo CD is installed with cluster-wide permissions, meaning it can read and manage resources across all namespaces. However, some organizations require a more restricted setup where Argo CD only has permissions within a single namespace. This is often referred to as "namespace-scoped" or "lockdown mode".
This page explains how to use argocd-diff-preview with a namespace-scoped Argo CD installation.
Why Lockdown Mode?🔗
When using a pre-installed Argo CD instance for diff previews, you may want to restrict its permissions for security reasons:
- Prevent secret access: A cluster-scoped Argo CD can read secrets from any namespace. With lockdown mode, Argo CD can only access resources in its own namespace.
- Isolation: The diff preview Argo CD instance is completely isolated from your production workloads.
How It Works🔗
In lockdown mode, argocd-diff-preview uses the Argo CD API directly to retrieve manifests, rather than relying on the application controller's sync status. This allows the tool to work even when Argo CD doesn't have permission to check the destination namespaces.
Requirements🔗
- Argo CD installed with
createClusterRoles: false(namespace-scoped) - The
--use-argocd-api="true"flag enabled when runningargocd-diff-preview
Installing Namespace-Scoped Argo CD🔗
Here's an example Helm values file for installing Argo CD with namespace-scoped permissions:
Install with:
helm repo add argo https://argoproj.github.io/argo-helm
helm install argo-cd argo/argo-cd \
--create-namespace \
--namespace argocd-diff-preview \
-f values.yaml
Running argocd-diff-preview in Lockdown Mode🔗
To use lockdown mode, add the --use-argocd-api="true" flag:
Limitations🔗
- Applications will show as "Unknown" status in the Argo CD UI since the application controller cannot access the destination namespaces
- Some ApplicationSet generators that require cluster-wide access may not work