# Cluster settings

**Cluster Settings** contains a variety of configurable parameters, including:&#x20;

* [General cluster settings](#general-settings)
* Various [customizations](#customizations)
* [Cluster labels](#cluster-labels)
* Status of the [Agent](#agent) connecting the cluster to PerfectScale

To navigate to the **`Custer Settings`** , go to the  **`Overview`** tab and find the needed cluster from the list of onboarded clusters. Hover over the cluster and click on the **`Gear`** button.&#x20;

<figure><img src="https://1573387604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABMqnYtsOO44JmQTVSnn%2Fuploads%2FtFw9WrHiVLxp9H0uCJlP%2FClusterSettings.gif?alt=media&#x26;token=ac2c2294-6fb9-43be-a3a0-7099851a79e5" alt=""><figcaption><p>Cluster settings</p></figcaption></figure>

## General Settings

<figure><img src="https://1573387604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABMqnYtsOO44JmQTVSnn%2Fuploads%2FKjr85gjuWAtX0nnO8IVB%2FGroup%201000002326.png?alt=media&#x26;token=6000137e-eb0f-49cf-af61-fae56b497be1" alt=""><figcaption><p>General cluster settings</p></figcaption></figure>

1. **Cluster Name** - (editable field) displays the name of the cluster.
2. **Optimization Policy** - specifies how resources should be allocated to achieve the desired level of resiliency. This allows setting policies to support the individual needs of your workloads. Keep the default or select one of the following values:

   * MaxSavings - maximum cost savings, the best for non-production environments
   * Balanced (default) - optimally balances cost and resiliency
   * ExtraHeadroom - the best fit for latency-sensitive environments&#x20;
   * MaxHeadroom - keeps the environment above the highest spikes

   Discover more about customizing the Optimization policy [here](https://docs.perfectscale.io/customize-workflow/optimization-policy-customization).
3. **Region** - (autodetected editable field) displays the region where the cluster is running.
4. **Cloud Provider** - (autodetected non-editable field) displays the cloud provider name.
5. **Initialization Date** - (non-editable field) displays the date when the cluster was added.
6. **Disconnect Cluster** - click on the button to disconnect the cluster from PerfectScale.
7. **Kubernetes version** - shows the Kubernetes version currently used by the cluster.

Click **`Save Changes`** button to save the changes or  **`Cancel & Close`** to discard them.

## Customizations

PerfectScale offers a range of customizable features designed to empower you in building your own optimized K8s ecosystem. These enhancements boost observability throughout your environment while streamlining processes like alerting, ticketing, and pricing management.

Explore the available customizations [here](https://docs.perfectscale.io/customize-workflow/customization-overview).

## Cluster labels

PerfectScale allows you to leverage your cluster labels, enabling you to organize and manage your Kubernetes clusters in the usual way. This capability is particularly helpful when managing large-scale Kubernetes environments with numerous clusters. By defining and applying cluster labels, you can streamline navigation and filtering across PerfectScale dashboards, ensuring quick access to the data you need.

<figure><img src="https://1573387604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABMqnYtsOO44JmQTVSnn%2Fuploads%2Fj1qlCuAYFiALJfY5eP9J%2FGroup%201000002266.png?alt=media&#x26;token=89e3164c-a707-49bf-8c7a-33d07efb276b" alt=""><figcaption><p>Cluster labels</p></figcaption></figure>

### Adding labels via the UI

There are two seamless approaches to add cluster labels:&#x20;

* [From the cluster settings](#add-cluster-labels-from-cluster-settings)
* [From the global settings](#add-cluster-labels-from-global-settings)

#### Add cluster labels from cluster settings

1. In the cluster list, click the **gear** icon next to the cluster name to open **Cluster Settings**.
2. Go to the **Labels** tab.
3. Click **+ New Label**.
4. Enter the **Label Key** and **Label Value**.

{% hint style="warning" %}
The label key must be unique per cluster. If you attempt to add a label using a key that already exists on that cluster, the label will not be applied.
{% endhint %}

{% hint style="info" %}
Both the Key and the Value are limited to a maximum of 225 characters. Only alphanumeric characters and the following special symbols are allowed: `. - _ /`.
{% endhint %}

5. Click **Save**.

<figure><img src="https://1573387604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABMqnYtsOO44JmQTVSnn%2Fuploads%2FdI9JsvcdwN0m2qSFKLeB%2Fcluster%20settings%20labels.gif?alt=media&#x26;token=ce3f911e-280e-463b-a55f-520be1881ad2" alt=""><figcaption><p>Add cluster label - cluster settings</p></figcaption></figure>

#### Add cluster labels from global settings

1. Navigate to **Global Settings** in the bottom-left corner of the screen.
2. Open **Cluster Labels**.
3. Under the desired cluster, click **+ New Label**.
4. Enter the **Label Key** and **Label Value**.

{% hint style="warning" %}
The label key must be unique per cluster. If you attempt to add a label using a key that already exists on that cluster, the label will not be applied.
{% endhint %}

{% hint style="info" %}
Both the Key and the Value are limited to a maximum of 225 characters. Only alphanumeric characters and the following special symbols are allowed: `. - _ /`.
{% endhint %}

5. Click **Save**.

<figure><img src="https://1573387604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABMqnYtsOO44JmQTVSnn%2Fuploads%2FABtuaN4Mv2Vlonenx8bR%2Fglobal%20settings.gif?alt=media&#x26;token=138e1d79-45f2-46d2-b002-5b6c358ddb2f" alt=""><figcaption><p>Add cluster label - global settings</p></figcaption></figure>

### How to edit/delete a label in the UI

You can seamlessly edit or delete labels. Simply hover over the label in either the cluster settings or the global settings, and select the desired action.

<figure><img src="https://1573387604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABMqnYtsOO44JmQTVSnn%2Fuploads%2Fr40ew0QHX0RkSIH75v6K%2Fimage.png?alt=media&#x26;token=10e47cdd-6400-466b-8b73-ac69abdc9075" alt=""><figcaption><p>Label actions</p></figcaption></figure>

### Adding labels via CRD

{% hint style="warning" %}
Labels defined in the CRD take precedence over labels added via the UI. If both define the same key, the value from the CRD will be used.

**Example**:

Label added via the UI: `env: prod`

Label defined in the CRD: `env: app`

**Result:** `env: app` is applied (CRD has higher priority).
{% endhint %}

To add labels using a Custom Resource Definition (CRD), you’ll need to define and apply a Custom Resource (CR) that specifies these labels (`key: value`). This approach allows you to manage labels directly through Kubernetes manifests.&#x20;

Here is an example of the CR configuration:

```yaml
apiVersion: perfectscale.io/v1
kind: ClusterSettings
metadata:
  name: cluster-settings
  namespace: perfectscale
spec:
  # Cluster classification labels
  clusterLabels:
    env: production
    team: platform
    cost-center: engineering
```

{% hint style="info" %}
Both the Key and the Value are limited to a maximum of 225 characters. Only alphanumeric characters and the following special symbols are allowed: `. - _ /`.
{% endhint %}

Labels defined via the CRD are displayed in the UI with a dedicated `CRD` flag. Such labels cannot be edited in the UI and can only be updated in the CRD.

<figure><img src="https://1573387604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABMqnYtsOO44JmQTVSnn%2Fuploads%2FlwCVK7GzGc2qli9W7n9h%2FFrame%201707478485.png?alt=media&#x26;token=38d46390-47c5-497f-a99c-2fece531162c" alt=""><figcaption><p>Cluster label via CRD</p></figcaption></figure>

## Agent&#x20;

PerfectScale delivers its services through agents like the **PSC Exporter** and **PSC AutoScaler**. To continuously analyze your environment, provide recommendations, and execute automation on your clusters, it's essential to have the relevant agent installed.&#x20;

<figure><img src="https://1573387604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABMqnYtsOO44JmQTVSnn%2Fuploads%2FoUnwjNGfpQmtO6KPCgDb%2Fimage.png?alt=media&#x26;token=d722f18b-5ff1-432e-9974-fb02cfd61222" alt=""><figcaption><p>PerfectScale Agent</p></figcaption></figure>

{% hint style="info" %}
If you don't see a <mark style="color:green;">**green (upgrade available)**</mark> or <mark style="color:orange;">**orange (upgrade required)**</mark> indicator, it means the agent is up to date and no action is needed.
{% endhint %}

Easily check the current version of the Agent or delve into the Release Notes. Clicking the **`Release Notes`** button takes you to GitHub, where you can explore comprehensive release details, including changes and assets.

In order to ensure you receive superior service and benefit from the latest features, an update of the agent components might be needed. In that case, the relevant indicator will be raised to inform you whether the upgrade is [<mark style="color:green;">**available**</mark>](#upgrade-available) or [<mark style="color:orange;">**required**</mark>](#upgrade-required), along with further instructions provided.

### Upgrade Available

Upgrade Available indicates that a new version is ready for installation, while PerfectScale continues data processing with the current version.&#x20;

Click the **`Upgrade Available`** indicator to explore the details. To upgrade the agent, click the **`View Upgrade Instructions`** button and follow the provided guide.

<figure><img src="https://1573387604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABMqnYtsOO44JmQTVSnn%2Fuploads%2FFgJDSlMbNtEQit0xFtna%2FUpgrade%20available.gif?alt=media&#x26;token=3659efac-688d-4646-a1d4-b789e014eed1" alt=""><figcaption><p>Agent upgrade available</p></figcaption></figure>

{% hint style="info" %}
Use the **--reset-then-reuse-values** flag to reuse the values from the last deployment of a release, overriding only the parameters explicitly set in the command. This flag retains existing values and changes only specific parameters, ensuring all other values remain the same as in the previous deployment. \
**NOTE:** **-- reset-then-reuse-values** is only available in **Helm 3.14 or newer** versions.&#x20;
{% endhint %}

{% hint style="info" %}
If you are using the older Helm version, turn the **Helm 3.14+** toggle off and upgrade the Agent with the provided Helm.

![](https://1573387604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABMqnYtsOO44JmQTVSnn%2Fuploads%2F5iD2Dy7Z9VLtdxaO9TXV%2Fagent%20upgrade.gif?alt=media\&token=263712c8-c91f-4bf2-9a83-60cbd452ff9e)
{% endhint %}

### Upgrade Required

Upgrade Required indicates that the current version is incompatible, and an upgrade is required to continue data processing by PerfectScale.

Click the **`Upgrade Required`** indicator to explore the details. To upgrade the agent, click the **`View Upgrade Instructions`** button and follow the provided guide.

<figure><img src="https://1573387604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABMqnYtsOO44JmQTVSnn%2Fuploads%2FpImM49lGOAH9GXz1dtv9%2FUpgrade%20required.gif?alt=media&#x26;token=2ba094d1-e992-44b8-abe2-dda3899a3242" alt=""><figcaption><p>Agent upgrade required</p></figcaption></figure>

{% hint style="info" %}
Use the **-- reset-then-reuse-values** flag to reuse the values from the last deployment of a release, overriding only the parameters explicitly set in the command. This flag retains existing values and changes only specific parameters, ensuring all other values remain the same as in the previous deployment. \
**NOTE:** **-- reset-then-reuse-values** is only available in **Helm 3.14 or newer** versions.&#x20;
{% endhint %}

{% hint style="info" %}
If you are using an older Helm version, turn the **Helm 3.14+** toggle off and upgrade the Agent with the provided Helm command.

![](https://1573387604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABMqnYtsOO44JmQTVSnn%2Fuploads%2FAnna8uI8emAmj3l7fF41%2Fagent%20upgrade.gif?alt=media\&token=bd6dd7e3-0283-4025-bd72-6f8c388cfd7a)
{% endhint %}

### Specifying an optimization policy or returning to the default

{% hint style="info" %}
If you set an optimization policy or custom time window using `helm upgrade`, you won’t be able to change these settings in the UI until you revert them to the defaults.
{% endhint %}

When upgrading the Agent, you can seamlessly specify an optimization policy and set a [custom time window](https://docs.perfectscale.io/customize-workflow/optimization-policy-customization).

To specify an optimization policy and/or a custom time window when installing the Agent, use the following command:

```yaml
helm upgrade --install -n some-release-name --create-namespace some-namespace \
  --set secret.create=true \
  --set secret.clientId=CLIENT_ID \
  --set secret.clientSecret=CLIENT_SECRET \
  --set settings.clusterName=CLUSTER_NAME \
  --set settings.clusterOptimizationPolicy="MaxSavings" \ # specify a desired optimization policy
  --set settings.optimizationPolicyTimeWindow="21d" \ # set a desired custom time window
  perfectscale/exporter
```

To revert to the default optimization policy and time window, upgrade the Agent using the following command:

```yaml
helm upgrade --install -n some-release-name --create-namespace some-namespace \
  --set secret.create=true \
  --set secret.clientId=CLIENT_ID \
  --set secret.clientSecret=CLIENT_SECRET \
  --set settings.clusterName=CLUSTER_NAME \
  perfectscale/exporter
```

{% hint style="info" %}
To revert to the default optimization policy and time window, do not specify `clusterOptimizationPolicy` and `optimizationPolicyTimeWindow`.
{% endhint %}

## Delete a cluster

{% hint style="info" %}
The endpoint removes the cluster instance from PerfectScale.
{% endhint %}

There may be situations where you need to remove a cluster from PerfectScale. You can seamlessly delete a cluster using the Public API. Learn more [here](https://docs.perfectscale.io/api/public-api#deleting-a-cluster).
