# Re-onboarding a cluster

You may encounter situations where re-uploading a cluster is necessary. For example, if you disconnect a cluster, you might later need to upload it again to restore its visibility and management within the PerfectScale.&#x20;

{% hint style="warning" %}
When you reconnect your cluster using the [standard configuration](https://docs.perfectscale.io/getting-started/how-to-onboard-a-cluster), PerfectScale will assign it a new ID and treat it as a new cluster. The historical data from the previous cluster will remain associated with the original cluster rather than the newly connected one. To restore your cluster while keeping it associated with its historical data, follow the instructions below.
{% endhint %}

## How to retrieve credentials&#x20;

To retrieve the **clusterName**, **clientID**, and **clientSecret** by executing the following commands accordingly:

#### **clusterName**

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

#### clientID

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

#### clientSecret

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

## Re-installing PerfectScale Agent

{% hint style="info" %}
While installing the PerfectScale Agent **(4)**, ensure that you use the same **clusterName** as previously used.\
\
![Cluster configuration](https://1573387604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABMqnYtsOO44JmQTVSnn%2Fuploads%2FFipvIXqgI9UfpZqwLxp9%2Fimage.png?alt=media\&token=56b442ab-de42-46d7-a9b3-b0dbaa6d9dde)<br>
{% endhint %}

Use the following command to re-upload the cluster:

```yaml
helm upgrade --install -n perfectscale --create-namespace perfectscale \
      --set secret.create=true \
      --set secret.clientId=your_clientId \
      --set secret.clientSecret=your_clientSecret \
      --set settings.clusterName=your_cluster_name \
      perfectscale/exporter
```

{% hint style="info" %}
You can either reuse the clientId and ClientSecret already used for this cluster, or take an existing Id/Secret pair from another running cluster.
{% endhint %}

{% hint style="info" %}
If taints and tolerations are defined in the node pool, you must include them in the command too, so it will appear like this:

```
helm upgrade --install -n perfectscale --create-namespace perfectscale \      
      --set secret.create=true \
      --set secret.clientId=your_clientId \
      --set secret.clientSecret=your_clientSecret \
      --set settings.clusterName=your_cluster_name \
      --set tolerations[0].key=node_pool \
      --set tolerations[0].operator=Equal \
      --set tolerations[0].value=tooling \
      --set kube-state-metrics.tolerations[0].key=node_pool,kube-state-metrics.tolerations[0].value=tooling,kube-state-metrics.tolerations[0].operator=Equal \
      perfectscale/exporter
```

{% endhint %}

## Re-installing PerfectScale Automation Agent

If you've re-uploaded the cluster where PerfectScale Automation was previously operational and wish to resume using Automation for that cluster, it's important to re-install the Automation Agent. This step will ensure that your cluster remains continuously optimized, tailored to your previously configured CR.

When re-installing the Automation Agent, run the following command:

```
helm upgrade --install -n perfectscale psc-autoscaler \
      --set secret.create=false \
      perfectscale/psc-autoscaler
```

{% hint style="info" %}
If taints and tolerations are defined in the node pool, you must include them in the command too, so it will appear like this:

```
helm upgrade --install -n perfectscale psc-autoscaler \
      --set tolerations[0].key=node_pool \
      --set tolerations[0].operator=Equal \
      --set tolerations[0].value=tooling \
      --set secret.create=false \
      perfectscale/psc-autoscaler
```

{% endhint %}
