docs/operator-manual/managed-by-url.md
The argocd.argoproj.io/managed-by-url annotation allows an Application resource to specify which Argo CD instance manages it. This is useful when you have multiple Argo CD instances and need application links in the UI to point to the correct managing instance.
When using multiple Argo CD instances with the app-of-apps pattern:
The managed-by-url annotation ensures application links redirect to the correct Argo CD instance.
[!NOTE] This annotation is particularly useful in multi-tenant setups where different teams have their own Argo CD instances, or in hub-and-spoke architectures where a central instance manages multiple edge instances.
This example demonstrates the app-of-apps pattern where a parent Application deploys child Applications from a Git repository.
Create a parent Application in your primary Argo CD instance:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: parent-app
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/YOUR-ORG/my-apps-repo.git
targetRevision: main
path: path-to-child-app
destination:
server: https://kubernetes.default.svc
namespace: namespace-b
syncPolicy:
automated:
selfHeal: true
prune: true
In your Git repository at apps/child-apps/child-app.yaml, add the managed-by-url annotation:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: child-app
namespace: namespace-b
annotations:
argocd.argoproj.io/managed-by-url: "http://localhost:8081" # replace with actual secondary ArgoCD URL in real setup
spec:
project: default
source:
repoURL: https://github.com/YOUR-ORG/my-apps-repo.git
targetRevision: HEAD
path: path-to-child-app
destination:
server: https://kubernetes.default.svc
namespace: namespace-b
syncPolicy:
automated:
selfHeal: true
prune: true
When viewing the parent Application in the primary instance's UI:
child-app in the resource tree navigates to https://secondary-argocd.example.com/applications/namespace-b/child-app| Field | Value |
|---|---|
| Annotation | argocd.argoproj.io/managed-by-url |
| Target | Application |
| Value | Valid HTTP(S) URL |
| Required | No |
The annotation value must be a valid HTTP(S) URL:
https://argocd.example.comhttps://argocd.example.com:8080http://localhost:8080 (for development)argocd.example.com (missing protocol)javascript:alert(1) (invalid protocol)Invalid URLs will prevent the Application from being created or updated.
When generating application links, Argo CD:
[!WARNING] Ensure the URL in the annotation is accessible from users' browsers. For internal deployments, use internal DNS names or configure appropriate network access.
To test the annotation with two local Argo CD instances:
# Install primary instance
kubectl create namespace argocd
kubectl apply -n argocd --server-side --force-conflicts -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
# Install secondary instance
kubectl create namespace namespace-b
kubectl apply -n namespace-b --server-side --force-conflicts -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
# Port forward both instances
kubectl port-forward -n argocd svc/argocd-server 8080:443 &
kubectl port-forward -n namespace-b svc/argocd-server 8081:443 &
# Wait for Argo CD to be ready
kubectl wait --for=condition=available --timeout=300s deployment/argocd-server -n argocd
# Get the admin password for primary instance
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d && echo
Then:
http://localhost:8080 in your browseradmin and the password from the command aboveparent-app Applicationchild-app in the resource treehttp://localhost:8081/applications/namespace-b/child-appYou will need to repeat the command to get the password for the secondary instance to login and access the child-app
# Get the admin password for secondary instance
kubectl -n namespace-b get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d && echo
Check if the annotation is present:
kubectl get application child-app -n instance-b -o jsonpath='{.metadata.annotations.argocd\.argoproj\.io/managed-by-url}'
Expected output: A complete URL like http://localhost:8081 or the url that has been set
i.e https://secondary-argocd.example.com
If the annotation is present but links still don't work:
http:// or https://)If Application creation fails with "invalid managed-by URL" error:
https:// or http://)javascript:)For app-of-apps patterns, ensure:
Verify the child Application exists:
kubectl get application CHILD-APP-NAME -n NAMESPACE