> 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/customize-workflow/label-customizations.md).

# Label customizations

Explore advanced label configuration

PerfectScale can recognize some labels automatically. However, it can be set up manually for advanced label configuration. This is particularly helpful when you are using custom labels to organize your K8s resources.

You can customize your labels for the workloads as well as for nodes. Currently, there are available the following options:

<table><thead><tr><th width="240">Label</th><th>Description</th></tr></thead><tbody><tr><td><strong>workload_labels</strong></td><td>Defines labels that can be applied to Kubernetes resources (pods, deployments, or stateful sets) to identify and manage workloads within a cluster.</td></tr><tr><td><strong>spot_labels</strong></td><td>Identifies spot nodes.</td></tr><tr><td><strong>node_group_labels</strong></td><td>Identifies the nodes group in a cluster.</td></tr><tr><td><strong>architecture_labels</strong></td><td>Specifies the architecture of the node (x86_64, arm64, etc.)</td></tr><tr><td><strong>os_labels</strong></td><td>Specifies the operating system running on a node within the Kubernetes cluster.</td></tr><tr><td><strong>instance_type_labels</strong></td><td>Specifies the type or configuration of VMs (instances) within a cloud infrastructure.</td></tr><tr><td><strong>region_labels</strong></td><td>Specifies the geographical region where a particular resource is located.</td></tr><tr><td><strong>availability_zone_labels</strong></td><td>Specify the availability zone where a particular resource is located.</td></tr><tr><td><strong>ignored_pod_labels</strong></td><td>Defines labels that Kubernetes components should disregard when making pod decisions.</td></tr><tr><td><strong>ignored_node_labels</strong></td><td>Defines labels that Kubernetes components should disregard when making node decisions.</td></tr></tbody></table>

## Label Formatting

Kube-state-metrics exposes labels following Prometheus conventions:

1. Add the `label_` prefix to the label
2. Replace non-alphabetic characters with underscores
3. Convert camel case to snake case by using underscores to separate words

{% hint style="info" %}
**Example**

kubernetes.azure.com/scalesetpriority: spot

```
node:
  spot_labels:
    label_kubernetes_azure_com_scalesetpriority: spot
```

{% endhint %}

## Configuring Custom Labels with the profile

### :tools: **How to create** **Customization Profile**

There are two options for creating a Profile: [from the Settings tab](#from-the-settings-tab) or directly [from the Overview](#from-the-overview-tab).

#### From the **Settings** tab

Go to the **`Settings`** tab on the left panel -> select **`Customizations`** -> click the **`+Add Profile`** button -> name and configure the profile -> click **`Save`** button.

<figure><img src="https://1573387604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABMqnYtsOO44JmQTVSnn%2Fuploads%2FVMb9j8Xgnjtl4muUuv1g%2FArea.gif?alt=media&amp;token=01c6ca6a-b8ff-44b6-99ea-d29e63a96dc5" alt=""><figcaption><p>Customizations profile from settings</p></figcaption></figure>

#### From the **Overview** tab

Go to the **`Overview`** tab on the left panel -> find the cluster to which you want to apply the **`Customization Profile`** and click **`gear`** button -> go to **`Customizations`** -> click on **`Add New Profile`** in the **`Customization Profile`** drop-down list -> name and configure your profile -> click the **`Save And Apply`** button -> click the **`Save Changes`** button.

<figure><img src="https://1573387604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABMqnYtsOO44JmQTVSnn%2Fuploads%2FHYURgOOJcZ7SLbOrxDe3%2Fcustom2.gif?alt=media&amp;token=432e3cb9-fad6-48ff-823a-d29995540737" alt=""><figcaption><p>Customizations profile from overview</p></figcaption></figure>

{% hint style="info" %}
Use **`Set as default`** checkbox to automatically assign the profile to the clusters.\
\
:bulb: **NOTE**: The manually assigned profile takes priority over the default one.
{% endhint %}

### :tools: **How to apply** Customization **Profile**

#### Apply to a single cluster

To apply **`Customization Profile`** to the cluster, go to the **`Overview`** tab on the left panel -> find the cluster to which you want to apply the **`Customization Profile`** and click **`gear`** button -> go to **`Customizations`** -> select the needed profile in the **`Customization Profile`** drop-down list.&#x20;

<figure><img src="https://1573387604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABMqnYtsOO44JmQTVSnn%2Fuploads%2FCZ77rj92gdwFQQcu8XFB%2Fcustom_single.gif?alt=media&amp;token=c50869c9-adb5-4dbd-b11a-cdb59a283389" alt=""><figcaption><p>Applying customization profile to a single cluster</p></figcaption></figure>

#### Apply to multiple clusters

To apply the profile to **multiple clusters** from a single view, use the **`Manage Assignments`** feature.&#x20;

Go to the **`Settings`** tab on the left panel -> select the **`Customizations`** -> click the **`Manage Assignments`** button -> apply the profiles for the needed clusters -> click the **`Save Changes`** button.

<figure><img src="https://1573387604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABMqnYtsOO44JmQTVSnn%2Fuploads%2F05BMzP5I0l3TJPrZu8vn%2Fcustom_multip.gif?alt=media&amp;token=f1cc9b8c-9678-45ca-acef-25dd7db0b661" alt=""><figcaption><p>Applying customization profile to multiple clusters</p></figcaption></figure>

## Configuring Custom Labels with CR

To enable custom labels and node identification, you need to define and apply a Custom Resource (CR) with the required parameters. This approach allows you to manage Custom Labels directly through Kubernetes manifests.&#x20;

{% hint style="warning" %}
The Custom Resource (CR) must be created in the `perfectscale` namespace.
{% endhint %}

### Setup instructions

1. Identify the labels used in your Kubernetes cluster to distinguish workloads.
2. Identify the labels used for node properties such as spot instances, node groups, architecture, etc.
3. Configure the fields below to match your cluster’s label structure.
4. Configure the CR.

{% hint style="info" %}
Ensure labels follow Prometheus conventions. Learn more about the format [here](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
{% endhint %}

```yaml
apiVersion: perfectscale.io/v1
kind: ClusterSettings
metadata:
  name: cluster-settings-main
  namespace: perfectscale
spec:
  profiles:
    customization:
      - name: custom-workload-labels
        assigned: true
        value:
          workload_labels:
            label_io_codefresh_pipelineName: codefresh
            label_app_kubernetes_io_name: io
            label_app_kubernetes_io_component: app
            label_app_kubernetes_io_version: app1
          node:
            spot_labels:
              label_cloud_google_com_gke_nodepool: pool-2
              label_spotinst_io_node_lifecycle: spot
            node_group_labels:
              label_eks_amazonaws_com_nodegroup: migrate
              label_kops_k8s_io_instancegroup: kops
            architecture_labels:
              label_kubernetes_io_arch: amd64
              label_beta_kubernetes_io_arch: arm64
            os_labels:
              label_kubernetes_io_os: linux
              label_beta_kubernetes_io_os: linux
            instance_type_labels:
              label_node_kubernetes_io_instance_type: large
              label_beta_kubernetes_io_instance_type: x-large
          ignored_node_labels:
            label_uid: uid
```

⚙️ **CR parameters:**

<table><thead><tr><th width="288.8583984375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>workload_labels</code></strong></td><td>Defines labels that can be applied to Kubernetes resources (pods, deployments, or stateful sets) to identify and manage workloads within a cluster.</td></tr><tr><td><strong><code>spot_labels</code></strong></td><td>Identifies spot nodes (key-value pairs).</td></tr><tr><td><strong><code>node_group_labels</code></strong></td><td>Identifies the node groups in a cluster.</td></tr><tr><td><strong><code>architecture_labels</code></strong></td><td>Specifies the architecture of the node (x86_64, arm64, etc.).</td></tr><tr><td><strong><code>os_labels</code></strong></td><td>Specifies the operating system running on a node within the Kubernetes cluster.</td></tr><tr><td><strong><code>instance_type_labels</code></strong></td><td>Specifies the type or configuration of VMs (instances) within a cloud infrastructure</td></tr><tr><td><strong><code>region_labels</code></strong></td><td>Specifies the geographical region where a particular resource is located.</td></tr><tr><td><strong><code>availability_zone_labels</code></strong></td><td>Specifies the availability zone where a particular resource is located.</td></tr><tr><td><strong><code>ignored_pod_labels</code></strong></td><td>Defines labels that Kubernetes components should disregard when making pod decisions.</td></tr><tr><td><strong><code>ignored_node_labels</code></strong></td><td>Defines labels that Kubernetes components should disregard when making node decisions.</td></tr></tbody></table>
