Skip to content

Deploy resources to a different namespace

To grant Argo CD the permissions to manage resources in multiple namespaces, we need to configure the namespace with a label and the value being the namespace of the managing Argo CD instance.

For example, If Argo CD instance deployed in the namespace foo wants to manage resources in namespace bar. Update the namespace bar as shown below.

apiVersion: v1
kind: Namespace
  name: bar
  labels: foo // namespace of managing Argo CD instance


The above described method assumes that the user has admin privileges on their cluster, which would allow them to apply labels to namespaces.

Alternatively, users can achieve the same behavior by leveraging the .spec.syncPolicy field of an application. SyncPolicy allows users to have a namespace created with certain labels pre-configured at the time of application sync. Consider the following example Application:

kind: Application
  name: guestbook
  namespace: argocd
      labels: foo // namespace of managing Argo CD instance 
    - CreateNamespace=true
    server: https://kubernetes.default.svc
    namespace: bar 

The above described application will create a new namespace bar carrying a label foo at the time of application sync, and then deploy application resources in it, without requiring the user to be able to label namespace bar manually.

Users creating applications using the Argo CD UI instead of CLI must check the "auto-create namespace" box, and then switch to the yaml editor to add the label into .spec.syncPolicy.managedNamespaceMetadata.labels as described above.

A few points to keep in mind:

  • This method requires that the user create the namespace at app sync time using createNamespace=true or checking the auto-create namespace box in the UI, and not include their own namespace manifest in their git repository.
  • A destination namespace must be set in .spec.destination.namespace
  • Users should have admin privileges and/or access to a cluster scoped Argo CD instance

See for more information


There is a possibility that sync might fail at first try when using the above method. In such cases a follow up sync should be successful