---
title: "Configure clustering | Grafana Alloy documentation"
description: "Learn how to configure Grafana Alloy clustering"
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Configure clustering

You can configure Alloy to run with [clustering](../../get-started/clustering/) so that individual Alloy instances can work together for workload distribution and high availability.

To configure clustering, complete these two steps:

1. **Enable clustering in Alloy**: Configure Alloy itself to join a cluster using Helm chart settings or command-line flags.
2. **Enable clustering in components**: Add a `clustering` block to each component that should participate in workload distribution.

> Note
> 
> Cluster mode at the Alloy level doesn’t automatically distribute workload. You must also enable clustering in each component that should participate in the cluster. Only components with a configured `clustering` block distribute workload.

## Enable clustering in components

Several components support workload distribution through clustering, including `prometheus.scrape`, `loki.source.kubernetes`, and `pyroscope.scrape`. Refer to [Distribute workload across cluster nodes](./distribute-workload/) for the complete list.

To enable clustering in a component, add a `clustering` block with `enabled = true`:

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
prometheus.scrape "example" {
  targets    = discovery.kubernetes.pods.targets
  forward_to = [prometheus.remote_write.default.receiver]

  clustering {
    enabled = true
  }
}
```

## Next steps

- [Configure Alloy for clustering](./configure-alloy/): Enable clustering in your Alloy installation.
- [Distribute workload across cluster nodes](./distribute-workload/): Configure components to distribute workload.
