Alloy Clustering Mode on kubernetes

Hello,

I deployed Alloy instances in Azure AKS behind a local load balancer, and here is my Terraform configuration:


resource "kubernetes_manifest" "alloy" {
  # depends_on = [kubernetes_secret.tls_cert_secret]
  manifest = {
    apiVersion = "collectors.grafana.com/v1alpha1"
    kind       = "Alloy"
    metadata = {
      name      = "alloy"
      namespace = data.kubernetes_namespace.alloy_namespace.metadata[0].name
    }
    spec = {
      controller = {
        type = "daemonset"
      }
      service = {
        enabled               = true
        type                  = "ClusterIP" 
        internalTrafficPolicy = "Local"
        
      }
      alloy = {

        clustering = {
          enabled = true
        }
        configMap = {
          create = false
          name   = var.alloy_config_name
        }
        uiPathPrefix = "/"
        extraPorts = [
          
          {
            name       = "log-udp"
            port       = 514
            targetPort = 514
            protocol   = "UDP"
          }
          
        ]
        
        extraArgs = [
          "--feature.community-components.enabled=true",
          "--stability.level=experimental"
        ]
      }
      ingress = {
        enabled          = true
        faroPort         = 12345 #
        path             = "/"
        ingressClassName = "nginx"
        hosts            = [local.ingress_host]
      
      }
    
    }
  }
}

“As you can see, clustering is enabled and I have two participants in the Alloy cluster.

I’m performing SNMP polling with this conf :

prometheus.exporter.snmp "default" {

               config  = local.file.default.content

               targets = discovery.relabel.snmp_default.output

          }



prometheus.scrape "default" {

               targets = prometheus.exporter.snmp.default.targets

               scrape_timeout = "30s"

               scrape_interval = "300s"

               clustering {

                    enabled = true

               }

               forward_to = [prometheus.relabel.default.receiver]

          }

The problem is that only the participant with Local Node checked is scraping, so only a subset of my SNMP targets are being scraped.

Any help?

All I have to do is moving my deployment controller from k8s deployment to a statefulset.