ArgoCD › Applications

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

Intermediate

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.

Common follow-ups: What if the namespace needs labels? | Does this replace a namespace manifest?