grafana-agent

by Grafana

Helm chartv0.44.2App v0.44.2

Grafana Agent

About this chart

Grafana Agent Helm chart

Helm chart for deploying Grafana Agent to Kubernetes.

Usage

Setup Grafana chart repository

helm repo add grafana https://grafana.github.io/helm-charts
helm repo update

Install chart

To install the chart with the release name my-release:

helm install my-release grafana/grafana-agent

This chart installs one instance of Grafana Agent into your Kubernetes cluster using a specific Kubernetes controller. By default, DaemonSet is used. The controller.type value can be used to change the controller to either a StatefulSet or Deployment.

Creating multiple installations of the Helm chart with different controllers is useful if just using the default DaemonSet isn't sufficient.

Flow mode is the default

By default, Grafana Agent Flow is deployed. To opt out of Flow mode and use the older mode (called "static mode"), set the agent.mode value to static.

Values

KeyTypeDefaultDescription
agent.clustering.enabledboolfalseDeploy agents in a cluster to allow for load distribution. Only applies when agent.mode=flow.
agent.configMap.contentstring""Content to assign to the new ConfigMap. This is passed into tpl allowing for templating from values.
agent.configMap.createbooltrueCreate a new ConfigMap for the config file.
agent.configMap.keystringnilKey in ConfigMap to get config from.
agent.configMap.namestringnilName of existing ConfigMap to use. Used when create is false.
agent.enableReportingbooltrueEnables sending Grafana Labs anonymous usage stats to help improve Grafana Agent.
agent.envFromlist[]Maps all the keys on a ConfigMap or Secret as environment variables. https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#envfromsource-v1-core
agent.extraArgslist[]Extra args to pass to agent run: https://grafana.com/docs/agent/latest/flow/reference/cli/run/
agent.extraEnvlist[]Extra environment variables to pass to the agent container.
agent.extraPortslist[]Extra ports to expose on the Agent
agent.listenAddrstring"0.0.0.0"Address to listen for traffic on. 0.0.0.0 exposes the UI to other containers.
agent.listenPortint80Port to listen for traffic on.
agent.listenSchemestring"HTTP"Scheme is needed for readiness probes. If enabling tls in your configs, set to "HTTPS"
agent.modestring"flow"Mode to run Grafana Agent in. Can be "flow" or "static".
agent.mounts.dockercontainersboolfalseMount /var/lib/docker/containers from the host into the container for log collection.
agent.mounts.extralist[]Extra volume mounts to add into the Grafana Agent container. Does not affect the watch container.
agent.mounts.varlogboolfalseMount /var/log from the host into the container for log collection.
agent.resourcesobject{}Resource requests and limits to apply to the Grafana Agent container.
agent.securityContextobject{}Security context to apply to the Grafana Agent container.
agent.storagePathstring"/tmp/agent"Path to where Grafana Agent stores data (for example, the Write-Ahead Log). By default, data is lost between reboots.
agent.uiPathPrefixstring"/"Base path where the UI is exposed.
configReloader.customArgslist[]Override the args passed to the container.
configReloader.enabledbooltrueEnables automatically reloading when the agent config changes.
configReloader.image.digeststring""SHA256 digest of image to use for config reloading (either in format "sha256:XYZ" or "XYZ"). When set, will override configReloader.image.tag
configReloader.image.registrystring"ghcr.io"Config reloader image registry (defaults to docker.io)
configReloader.image.repositorystring"jimmidyson/configmap-reload"Repository to get config reloader image from.
configReloader.image.tagstring"v0.12.0"Tag of image to use for config reloading.
configReloader.resourcesobject{"requests":{"cpu":"1m","memory":"5Mi"}}Resource requests and limits to apply to the config reloader container.
configReloader.securityContextobject{}Security context to apply to the Grafana configReloader container.
controller.affinityobject{}Affinity configuration for pods.
controller.autoscaling.enabledboolfalseCreates a HorizontalPodAutoscaler for controller type deployment.
controller.autoscaling.maxReplicasint5The upper limit for the number of replicas to which the autoscaler can scale up.
controller.autoscaling.minReplicasint1The lower limit for the number of replicas to which the autoscaler can scale down.
controller.autoscaling.scaleDown.policieslist[]List of policies to determine the scale-down behavior.
controller.autoscaling.scaleDown.selectPolicystring"Max"Determines which of the provided scaling-down policies to apply if multiple are specified.
controller.autoscaling.scaleDown.stabilizationWindowSecondsint300The duration that the autoscaling mechanism should look back on to make decisions about scaling down.
controller.autoscaling.scaleUp.policieslist[]List of policies to determine the scale-up behavior.
controller.autoscaling.scaleUp.selectPolicystring"Max"Determines which of the provided scaling-up policies to apply if multiple are specified.
controller.autoscaling.scaleUp.stabilizationWindowSecondsint0The duration that the autoscaling mechanism should look back on to make decisions about scaling up.
controller.autoscaling.targetCPUUtilizationPercentageint0Average CPU utilization across all relevant pods, a percentage of the requested value of the resource for the pods. Setting targetCPUUtilizationPercentage to 0 will disable CPU scaling.
controller.autoscaling.targetMemoryUtilizationPercentageint80Average Memory utilization across all relevant pods, a percentage of the requested value of the resource for the pods. Setting targetMemoryUtilizationPercentage to 0 will disable Memory scaling.
controller.dnsPolicystring"ClusterFirst"Configures the DNS policy for the pod. https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy
controller.enableStatefulSetAutoDeletePVCboolfalseWhether to enable automatic deletion of stale PVCs due to a scale down operation, when controller.type is 'statefulset'.
controller.extraAnnotationsobject{}Annotations to add to controller.
controller.extraContainerslist[]Additional containers to run alongside the agent container and initContainers.
controller.hostNetworkboolfalseConfigures Pods to use the host network. When set to true, the ports that will be used must be specified.
controller.hostPIDboolfalseConfigures Pods to use the host PID namespace.
controller.initContainerslist[]
controller.nodeSelectorobject{}nodeSelector to apply to Grafana Agent pods.
controller.parallelRolloutbooltrueWhether to deploy pods in parallel. Only used when controller.type is 'statefulset'.
controller.podAnnotationsobject{}Extra pod annotations to add.
controller.podLabelsobject{}Extra pod labels to add.
controller.priorityClassNamestring""priorityClassName to apply to Grafana Agent pods.
controller.replicasint1Number of pods to deploy. Ignored when controller.type is 'daemonset'.
controller.tolerationslist[]Tolerations to apply to Grafana Agent pods.
controller.topologySpreadConstraintslist[]Topology Spread Constraints to apply to Grafana Agent pods.
controller.typestring"daemonset"Type of controller to use for deploying Grafana Agent in the cluster. Must be one of 'daemonset', 'deployment', or 'statefulset'.
controller.updateStrategyobject{}Update strategy for updating deployed Pods.
controller.volumeClaimTemplateslist[]volumeClaimTemplates to add when controller.type is 'statefulset'.
controller.volumes.extralist[]Extra volumes to add to the Grafana Agent pod.
crds.createbooltrueWhether to install CRDs for monitoring.
fullnameOverridestringnilOverrides the chart's computed fullname. Used to change the full prefix of resource names.
global.image.pullSecretslist[]Optional set of global image pull secrets.
global.image.registrystring""Global image registry to use if it needs to be overriden for some specific use cases (e.g local registries, custom images, ...)
global.podSecurityContextobject{}Security context to apply to the Grafana Agent pod.
image.digeststringnilGrafana Agent image's SHA256 digest (either in format "sha256:XYZ" or "XYZ"). When set, will override image.tag.
image.pullPolicystring"IfNotPresent"Grafana Agent image pull policy.
image.pullSecretslist[]Optional set of image pull secrets.
image.registrystring"docker.io"Grafana Agent image registry (defaults to docker.io)
image.repositorystring"grafana/agent"Grafana Agent image repository.
image.tagstringnilGrafana Agent image tag. When empty, the Chart's appVersion is used.
ingress.annotationsobject{}
ingress.enabledboolfalseEnables ingress for the agent (faro port)
ingress.extraPathslist[]
ingress.faroPortint12347
ingress.hosts[0]string"chart-example.local"
ingress.labelsobject{}
ingress.pathstring"/"
ingress.pathTypestring"Prefix"
ingress.tlslist[]
nameOverridestringnilOverrides the chart's name. Used to change the infix in the resource names.
rbac.createbooltrueWhether to create RBAC resources for the agent.
service.annotationsobject{}
service.clusterIPstring""Cluster IP, can be set to None, empty "" or an IP address
service.enabledbooltrueCreates a Service for the controller's pods.
service.internalTrafficPolicystring"Cluster"Value for internal traffic policy. 'Cluster' or 'Local'
service.nodePortint31128NodePort port. Only takes effect when service.type: NodePort
service.typestring"ClusterIP"Service type
serviceAccount.additionalLabelsobject{}Additional labels to add to the created service account.
serviceAccount.annotationsobject{}Annotations to add to the created service account.
serviceAccount.createbooltrueWhether to create a service account for the Grafana Agent deployment.
serviceAccount.namestringnilThe name of the existing service account to use when serviceAccount.create is false.
serviceMonitor.additionalLabelsobject{}Additional labels for the service monitor.
serviceMonitor.enabledboolfalse
serviceMonitor.intervalstring""Scrape interval. If not set, the Prometheus default scrape interval is used.
serviceMonitor.metricRelabelingslist[]MetricRelabelConfigs to apply to samples after scraping, but before ingestion. ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#relabelconfig
serviceMonitor.relabelingslist[]RelabelConfigs to apply to samples before scraping ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#relabelconfig
serviceMonitor.tlsConfigobject{}Customize tls parameters for the service monitor

agent.extraArgs

agent.extraArgs allows for passing extra arguments to the Grafana Agent container. The list of available arguments is documented on agent run.

WARNING: Using agent.extraArgs does not have a stable API. Things may break between Chart upgrade if an argument gets added to the template.

agent.extraPorts

agent.extraPorts allows for configuring specific open ports.

The detained specification of ports can be found at the Kubernetes Pod documents.

Port numbers specified must be 0 < x < 65535.

ChartPortKubePortDescription
targetPortcontainerPortNumber of port to expose on the pod's IP address.
hostPorthostPort(Optional) Number of port to expose on the host. Daemonsets taking traffic might find this useful.
namenameIf specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.
protocolprotocolMust be UDP, TCP, or SCTP. Defaults to "TCP".

agent.listenAddr

agent.listenAddr allows for restricting which address the agent listens on for network traffic on its HTTP server. By default, this is 0.0.0.0 to allow its UI to be exposed when port-forwarding and to expose its metrics to other agents in the cluster.

agent

Deploy grafana-agent with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has grafana-agent on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartgrafana-agent is pinned at v0.44.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply