---
title: "Configure Grafana Agent Flow on Kubernetes | Grafana Agent documentation"
description: "Learn how to configure Grafana Agent Flow on Kubernetes"
---

# Configure Grafana Agent Flow on Kubernetes

This page describes how to apply a new configuration to Grafana Agent Flow when running on Kubernetes with the Helm chart. It assumes that:

- You have [installed Grafana Agent Flow on Kubernetes using the Helm chart](../../../get-started/install/kubernetes/).
- You already have a new Grafana Agent Flow configuration that you want to apply to your Helm chart installation.

If instead you’re looking for help in configuring Grafana Agent Flow to perform a specific task, consult the following guides instead:

- [Collect and forward Prometheus metrics](../../collect-prometheus-metrics/),
- [Collect OpenTelemetry data](../../collect-opentelemetry-data/),
- or the [tasks section](../) for all the remaining configuration guides.

## Configure the Helm chart

To modify Grafana Agent Flow’s Helm chart configuration, perform the following steps:

1. Create a local `values.yaml` file with a new Helm chart configuration.
   
   1. You can use your own copy of the values file or download a copy of the default [values.yaml](https://raw.githubusercontent.com/grafana/agent/main/operations/helm/charts/grafana-agent/values.yaml).
   2. Make changes to your `values.yaml` to customize settings for the Helm chart.
      
      Refer to the inline documentation in the default [values.yaml](https://raw.githubusercontent.com/grafana/agent/main/operations/helm/charts/grafana-agent/values.yaml) for more information about each option.
2. Run the following command in a terminal to upgrade your Grafana Agent Flow installation:
   
   shell ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```shell
   helm upgrade --namespace <NAMESPACE> <RELEASE_NAME> grafana/grafana-agent -f <VALUES_PATH>
   ```
   
   Replace the following:
   
   - *`<NAMESPACE>`* : The namespace you used for your Grafana Agent Flow installation.
   - *`<RELEASE_NAME>`* : The name you used for your Grafana Agent Flow installation.
   - *`<VALUES_PATH>`* : The path to your copy of `values.yaml` to use.

### Kustomize considerations

If you are using [Kustomize](https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/) to inflate and install the [Helm chart](https://github.com/grafana/agent/tree/main/operations/helm/charts/grafana-agent), be careful when using a `configMapGenerator` to generate the ConfigMap containing the configuration. By default, the generator appends a hash to the name and patches the resource mentioning it, triggering a rolling update.

This behavior is undesirable for Grafana Agent Flow because the startup time can be significant, for example, when your deployment has a large metrics Write-Ahead Log. You can use the [Helm chart](https://github.com/grafana/agent/tree/main/operations/helm/charts/grafana-agent) sidecar container to watch the ConfigMap and trigger a dynamic reload.

The following is an example snippet of a `kustomization` that disables this behavior:

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

```yaml
configMapGenerator:
  - name: grafana-agent
    files:
      - config.river
    options:
      disableNameSuffixHash: true
```

## Configure the Grafana Agent Flow

This section describes how to modify the Grafana Agent Flow configuration, which is stored in a ConfigMap in the Kubernetes cluster. There are two methods to perform this task.

### Method 1: Modify the configuration in the values.yaml file

Use this method if you prefer to embed your Grafana Agent Flow configuration in the Helm chart’s `values.yaml` file.

1. Modify the configuration file contents directly in the `values.yaml` file:
   
   YAML ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```yaml
   agent:
     mode: "flow"
     configMap:
       content: |-
         // Write your Agent config here:
         logging {
           level = "info"
           format = "logfmt"
         }
   ```
2. Run the following command in a terminal to upgrade your Grafana Agent Flow installation:
   
   shell ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```shell
   helm upgrade --namespace <NAMESPACE> <RELEASE_NAME> grafana/grafana-agent -f <VALUES_PATH>
   ```
   
   Replace the following:
   
   - *`<NAMESPACE>`* : The namespace you used for your Grafana Agent Flow installation.
   - *`<RELEASE_NAME>`* : The name you used for your Grafana Agent Flow installation.
   - *`<VALUES_PATH>`* : The path to your copy of `values.yaml` to use.

### Method 2: Create a separate ConfigMap from a file

Use this method if you prefer to write your Grafana Agent Flow configuration in a separate file.

1. Write your configuration to a file, for example, `config.river`.
   
   Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```alloy
   // Write your Agent config here:
   logging {
     level = "info"
     format = "logfmt"
   }
   ```
2. Create a ConfigMap called `agent-config` from the above file:
   
   shell ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```shell
   kubectl create configmap --namespace <NAMESPACE> agent-config "--from-file=config.river=./config.river"
   ```
   
   Replace the following:
   
   - *`<NAMESPACE>`* : The namespace you used for your Grafana Agent Flow installation.
3. Modify Helm Chart’s configuration in your `values.yaml` to use the existing ConfigMap:
   
   YAML ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```yaml
   agent:
     mode: "flow"
     configMap:
       create: false
       name: agent-config
       key: config.river
   ```
4. Run the following command in a terminal to upgrade your Grafana Agent Flow installation:
   
   shell ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```shell
   helm upgrade --namespace <NAMESPACE> <RELEASE_NAME> grafana/grafana-agent -f <VALUES_PATH>
   ```
   
   Replace the following:
   
   - *`<NAMESPACE>`* : The namespace you used for your Grafana Agent Flow installation.
   - *`<RELEASE_NAME>`* : The name you used for your Grafana Agent Flow installation.
   - *`<VALUES_PATH>`* : The path to your copy of `values.yaml` to use.
