Advertisement
Intermediate ArgoCD, Applications

How do you set an Application to auto-create its target namespace?

Short answer

Add the CreateNamespace=true sync option so ArgoCD creates the destination namespace if it doesn't exist during sync, avoiding a separate namespace manifest. You can also add managed namespace metadata (labels/annotations) via the syncPolicy in newer versions.

Save ArgoCD mock interview
Advertisement
AModel answer
Add the CreateNamespace=true sync option so ArgoCD creates the destination namespace if it doesn't exist during sync, avoiding a separate namespace manifest. You can also add managed namespace metadata (labels/annotations) via the syncPolicy in newer versions.
syncPolicy:
  syncOptions:
    - CreateNamespace=true
Real-world example
A new app deploys cleanly on first sync because ArgoCD creates its namespace automatically.
Likely follow-ups
  • What if the namespace needs labels? | Does this replace a namespace manifest?
Related topics