> For the complete documentation index, see [llms.txt](https://docs.perfectscale.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.perfectscale.io/getting-started/onboarding-with-argocd.md).

# Onboarding with ArgoCD

## Installing agent with ArgoCD

To install the agent with ArgoCD, use the following instructions.

1. Complete 1-5 steps from [Onboarding a cluster](/getting-started/how-to-onboard-a-cluster.md).
2. Make sure to save the clientId and clientSecret, as we will require it later on. <br>

   <figure><img src="/files/PSKbY4DLUU2wVnTPCLng" alt="Credentials" width="563"><figcaption><p>Credentials</p></figcaption></figure>
3. Download the most recent Helm chart that is used for ArgoCD to your repository (for this guide, we'll be utilizing <git@github.com>:<mark style="background-color:yellow;">perfectscale/ps-kube.git</mark>).

```
helm fetch perfectscale/exporter
tar -xf exporter-*.tgz && rm exporter-*.tgz
```

4. Create an additional (for example, `dev.yaml` value) file with the following content&#x20;

{% hint style="danger" %}
**`clusterName`**&#x69;s mandatory. PerfectScale Agent will not work if the cluster name is not provided.
{% endhint %}

```
cat > exporter/dev.yaml <<EOF
secret:
  create: true
  name: "perfectscale-secret"
  clientSecret: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx"
  clientId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx"
settings:
  clusterName: "xxx"
EOF
```

:bulb:Replace `clientSecret` and `clientId` with copied before.

{% hint style="success" %}
If you have already installed the agent and need to recall the **clusterName**, **clientID**, and **clientSecret**, you can retrieve them using the following commands accordingly:

`kubectl -n perfectscale describe deployment perfectscale-exporter | grep CLUSTER_NAME`

`kubectl -n perfectscale get secret perfectscale-exporter-secret -o jsonpath="{.data.clientId}" | base64 --decode`\
\
`kubectl -n perfectscale get secret perfectscale-exporter-secret -o jsonpath="{.data.clientSecret}" | base64 --decode`
{% endhint %}

5. Push all the modifications to your git repository, which is accessible by ArgoCD.

{% hint style="info" %}
There are two methods to add an application to ArgoCD: [using the WEB UI](#web-ui) or [creating a YAML CR file](#crd). You can select the approach that best suits your infrastructure.
{% endhint %}

### WEB UI

1. Login to the ArgoCD Web UI interface and click the **`NEW APP`** button.<br>

   <figure><img src="/files/RdW2rm6lRDfNSJlR9imR" alt="New app ArgoCD"><figcaption><p>New app ArgoCD</p></figcaption></figure>

   <figure><img src="/files/GbutYUM2pxczmxzPlejb" alt="New app form1"><figcaption><p>New app form1</p></figcaption></figure>

   <figure><img src="/files/byx9q5DMVV1IZIdZ6RoH" alt="New app form2"><figcaption><p>New app form2</p></figcaption></figure>

   <figure><img src="/files/s0Mu6QGB0MNMvq0KLNSM" alt="New app form3"><figcaption><p>New app form3</p></figcaption></figure>

   <figure><img src="/files/IjYNZ3WPLkvZDRqzKTml" alt="New app form4"><figcaption><p>New app form4</p></figcaption></figure>

2. Once the creation process is completed, you will see the OutOFSync application.<br>

   <figure><img src="/files/5ZyJXcuSFJnFMcgDYtK2" alt="OutOFSync application"><figcaption><p>OutOFSync application</p></figcaption></figure>

3. Synchronize the application.<br>

   <figure><img src="/files/XwndgLHGG42Y8quvXoIE" alt="Application synchronization"><figcaption><p>Application synchronization</p></figcaption></figure>

   <figure><img src="/files/Ka1bCNiVGPtruzb73UEr" alt="Synchronized application"><figcaption><p>Synchronized application</p></figcaption></figure>

4. Ensure that all pods are running.<br>

   <figure><img src="/files/ve000osz13WZ7UP5QWrZ" alt="Check running pods1"><figcaption><p>Check running pods1</p></figcaption></figure>

### YAML Application manifest

{% hint style="info" %}
**Prerequisites:**

* ArgoCD installed in the cluster
* clientID and clientSecret (learn more [here](#installing-agent-with-argocd)).
  {% endhint %}

#### Single application (Recommended) <a href="#single-application-recommended" id="single-application-recommended"></a>

1. Create a file perfectscale.yaml with the following content

{% hint style="info" %}
Ensure you replace clientSecret, clientID and clusterName with your values
{% endhint %}

```
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: perfectscale-crd
  namespace: argocd
spec:
  project: default
  syncPolicy:
    syncOptions:
    - CreateNamespace=true
    - Validate=true
    - ServerSideApply=true
  destination:
    server: https://kubernetes.default.svc
    namespace: perfectscale
  sources:
  - repoURL: https://perfectscale-io.github.io
    chart: exporter
    targetRevision: v1.1.3
    helm:
      valuesObject:
        secret:
          create: true
          clientSecret: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx
          clientId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx
        settings:
          clusterName: replace-this-value-with-your-clusters-name
          corootNodeAgent:
            enabled: false
```

{% hint style="success" %}
To find the current latest chart version run:&#x20;

```
helm repo add perfectscale 
https://perfectscale-io.github.io
 --force-update && helm search repo perfectscale | egrep "NAME|perfectscale/exporter"
```

{% endhint %}

2. Apply the following command in the cluster application.

{% hint style="info" %}
Ensure you replace the `argocd` namespace with your own namespace where ArgoCD applications are stored.
{% endhint %}

```
kubectl apply -f perfectscale.yaml -n argocd
```

3. Check a new application in the ArgoCD.<br>

   <figure><img src="/files/O96KchIaCCPHWLDSpuVc" alt="New application in ArgoCD"><figcaption><p>New application in ArgoCD</p></figcaption></figure>

4. Sync the application.<br>

   <figure><img src="/files/ex9SgIve0QYgaoEuU1aI" alt="Sync the application"><figcaption><p>Sync the application</p></figcaption></figure>

5. Ensure that all pods are running.

```
kubectl get pods -n perfectscale
```

<figure><img src="/files/qDdaek74VFApldqdKJeo" alt="Check running pods2"><figcaption><p>Check running pods2</p></figcaption></figure>

## Troubleshooting <a href="#troubleshooting-crd-issues" id="troubleshooting-crd-issues"></a>

In rare cases (e.g., after an incomplete installation), CRD-related errors may occur during sync. If so, split the setup into two ArgoCD applications: one for CRDs and one for the agent.

Create a `perfectscale.yaml` file with both Application objects:

```yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: perfectscale-crds
  namespace: argocd
spec:
  project: default
  syncPolicy:
    automated:
      enabled: true
  destination:
    server: https://kubernetes.default.svc
  source:
    repoURL: https://github.com/perfectscale-io/perfectscale-io.github.io.git
    targetRevision: perfectscale-agent-v1.0.100
    path: charts/perfectscale-agent/crds
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: perfectscale-exporter-agent
  namespace: argocd
spec:
  project: default
  syncPolicy:
    automated:
      enabled: true
    syncOptions:
    - CreateNamespace=true
    - Validate=true
    - ServerSideApply=true
  destination:
    server: https://kubernetes.default.svc
    namespace: perfectscale
  sources:
  - repoURL: https://perfectscale-io.github.io
    chart: exporter
    targetRevision: v1.1.3
    helm:
      skipCrds: true
      valuesObject:
        secret:
          create: true
          clientSecret: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx
          clientId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx
        settings:
          clusterName: replace-this-value-with-your-clusters-name
          corootNodeAgent:
            enabled: false
```

Apply both with a single command:

```
kubectl apply -f perfectscale.yaml -n argocd
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.perfectscale.io/getting-started/onboarding-with-argocd.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
