Skip to content

grafana/alloy-operator

Repository files navigation

Alloy Operator

The Alloy Operator is a Kubernetes Operator that manages the lifecycle of Grafana Alloy instances. It is built with the Operator SDK using the Alloy Helm chart as its base.

Usage

To use the Alloy Operator, there are three steps to follow:

  1. Deploy the Alloy Operator.
  2. Deploy an Alloy instance.

Deploy the Alloy Operator

$ helm install alloy-operator grafana/alloy-operator

Deploy an Alloy instance

Create a file for your Alloy instance:

---
apiVersion: collectors.grafana.com/v1alpha1
kind: Alloy
metadata:
  name: alloy-test
spec:
  alloy:
    configMap:
      content: |-
        prometheus.exporter.self "default" {}

        prometheus.scrape "default" {
          targets    = prometheus.exporter.self.default.targets
          forward_to = [prometheus.remote_write.local_prom.receiver]
        }

        prometheus.remote_write "local_prom" {
          endpoint {
            url = "http://prometheus-server.prometheus.svc:9090/api/v1/write"
          }
        }

The spec section supports all fields in the Alloy Helm chart's values file.

For some examples, see the tests that are used within this repository:

NOTE: The Alloy instances do not deploy the PodLogs CRD, nor does it support the crds field in the spec.

Contributing

We welcome contributions to the Grafana Alloy Operator! Please see our Contributing Guide for more information.