# Automation setup instructions

{% hint style="info" %}
Automation is currently available for workloads with type **`Deployment`**, **`DaemonSet`**, **`StatefulSet`**, **`CronJob`** and **`Job`**.&#x20;
{% endhint %}

{% hint style="warning" %}
PerfectScale **does not support** automating workloads that use the **OnDelete update strategy**. The OnDelete strategy requires manual intervention to update pods, which falls outside the scope of PerfectScale's automated optimization capabilities.
{% endhint %}

To set up Automation, you can either follow the installation guide below or complete the setup directly within the platform. Both options make it easy to get started, so you can choose the one that best fits your workflow.

{% hint style="info" %}
To access the Automation enablement guide within the platform, go to the **Overview** screen, hover over the cluster you want to automate, and click the **Configure** button under the **Automated** column.
{% endhint %}

<figure><img src="https://1573387604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABMqnYtsOO44JmQTVSnn%2Fuploads%2Fy53SDlc0k3eoNeElnVG1%2FGroup%201000001937.png?alt=media&#x26;token=bc6e9ddf-f391-432c-bc9a-fdbf5200bfdc" alt=""><figcaption><p>Configure button</p></figcaption></figure>

## Step 1: Install PerfectScale Automation Agent

{% hint style="warning" %}
When deploying the **PerfectScale Automation Agent** in a **GKE Private Cluster**, you need to create an additional firewall rule. This enables the Control Plane address range to communicate with the Cluster Pod IPv4 address range on port 8443. If the webhook call fails, see the [troubleshooting guide](https://docs.perfectscale.io/troubleshooting#failed-to-call-webhook).
{% endhint %}

Deploy the PerfectScale automation agent. In order to install the PerfectScale automation agent, run the following commands:

```
helm repo add perfectscale https://perfectscale-io.github.io --force-update
```

and

```
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 %}

{% hint style="warning" %}
If you utilize CI/CD tools with auto-sync, ensure to review the additional configuration steps. [automation-with-gitops](https://docs.perfectscale.io/enable-automation/automation-with-gitops "mention")
{% endhint %}

{% hint style="info" %}
Follow the [**troubleshooting**](https://docs.perfectscale.io/enable-automation/troubleshooting) instructions provided, or [**contact support**](https://join.slack.com/t/perfectscalecommunity/shared_invite/zt-1tu9teu9e-Z9tGt4LpNI8tUC3j8obcmQ) if you encounter any issues.
{% endhint %}

### Verify Automation Agent Installation

To test and confirm that the Automation Agent was installed successfully, run the following command:

```
helm test psc-autoscaler -n perfectscale --logs
```

### Disabling Webhook for Specific Namespaces

Once the autoscaler is installed, all pods in the cluster go through the admission webhook. You can exclude specific namespaces from this process by disabling the webhook for them. For example:

<pre><code>helm upgrade --install -n perfectscale psc-autoscaler perfectscale/psc-autoscaler \
--set secret.create=false \
<a data-footnote-ref href="#user-content-fn-1">--set 'settings.excludedNamespaces={kube-system,ns_to_exclude1,ns_to_exclude2}'</a>
</code></pre>

## Step 2: Configure Automation

PerfectScale provides two ways to configure Automation and tailor it to your environment:&#x20;

* [**Through the UI**](https://docs.perfectscale.io/enable-automation/configuring-automation-via-ui) \
  A good starting point if you want to quickly explore and enable Automation, such as during a POC or in environments where a simple setup is sufficient.

{% hint style="warning" %}
UI automation provides a simplified experience and supports only part of the features. Full functionality and advanced configuration are available [via CRDs](https://docs.perfectscale.io/enable-automation/configuring-automation-with-crd).
{% endhint %}

* [**By using a Custom Resource (CR)**](https://docs.perfectscale.io/enable-automation/configuring-automation-with-crd) \
  The best suits for teams that require more control and customization, as this option provides greater flexibility and configuration granularity.

The UI offers a simple and convenient way to set up and manage Automation directly in the platform, while the CR option enables flexible, GitOps-friendly configuration within your Kubernetes workflows. Explore how to configure Automation using one of the approaches described above by clicking the links above.

{% hint style="info" %}
**CRD configuration takes priority** over UI settings. If both are enabled, PerfectScale will apply automation based on the CRD configuration. You can still preview the list of automated workloads in the UI, but any changes should be made through the CRD.
{% endhint %}

[^1]: Exclude a Namespace


---

# Agent Instructions: 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/enable-automation/automation-setup-instructions.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.
