# Deploying Private Locations at Scale with Argo CD

Use an Argo CD **ApplicationSet** to deploy Private Locations across several clusters.

## Prerequisites

Before you begin, ensure you've got:

- Argo CD installed and configured on your clusters
- A Kubernetes Secret containing your Escape API key in the destination `escape` namespace on each cluster

## Create an ApplicationSet to Deploy to Several Clusters

Create an ApplicationSet using the Helm repository URL in `repoURL`. Set `metadata.namespace` to your Argo CD control-plane namespace (`argocd` in this example). Other namespaces require [ApplicationSets in Any Namespace](<https://argo-cd.readthedocs.io/en/latest/operator-manual/applicationset/Appset-Any-Namespace/>) configuration. The destination namespace is where the Private Location workload runs.

Use a unique `privateLocationName` for each agent to avoid disrupting another agent's connection. Keep `targetRevision` pinned to the chart version you've selected; the example uses `1.9.1`. Set `existingSecret.name` and `existingSecret.key` to match the Secret on each cluster.

```yaml
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: escape-private-location
  namespace: argocd
spec:
  goTemplate: true
  goTemplateOptions: ["missingkey=error"]
  generators:
    - list:
        elements:
          - cluster: staging-cluster
            url: https://1.2.3.4
            privateLocationName: staging
          - cluster: prod-cluster
            url: https://2.4.6.8
            privateLocationName: prod
  template:
    metadata:
      name: '{{.cluster}}-escape'
    spec:
      project: default
      source:
        repoURL: https://escape-technologies.github.io/cli/
        chart: private-location
        targetRevision: 1.9.1
        helm:
          parameters:
            - name: ESCAPE_PRIVATE_LOCATION
              value: '{{.privateLocationName}}'
            - name: existingSecret.name
              value: escape-api-key
            - name: existingSecret.key
              value: ESCAPE_API_KEY
      destination:
        server: '{{.url}}'
        namespace: escape
      syncPolicy:
        automated:
          prune: true
          selfHeal: true
```

## Save the File in Your Argo CD Repo

1. Add the created manifest to your Argo CD repo
2. Let Argo CD sync

For more information, see the official [Argo CD documentation](<https://argo-cd.readthedocs.io/en/stable/operator-manual/applicationset/>).
