victoria-metrics-agent

by apecloud

Helm chartv0.8.41App v1.91.3Verified publisher

Victoria Metrics Agent - collects metrics from various sources and stores them to VictoriaMetrics

About this chart

Helm Chart For Victoria Metrics Agent.

Victoria Metrics Agent - collects metrics from various sources and stores them to VictoriaMetrics

Prerequisites

  • Install the follow packages: git, kubectl, helm, helm-docs. See this tutorial.

How to install

Access a Kubernetes cluster.

Add a chart helm repository with follow commands:

helm repo add vm https://victoriametrics.github.io/helm-charts/

helm repo update

List versions of vm/victoria-metrics-agent chart available to installation:

for helm v3

helm search repo vm/victoria-metrics-agent -l

Export default values of victoria-metrics-agent chart to file values.yaml:

helm show values vm/victoria-metrics-agent > values.yaml

Change the values according to the need of the environment in values.yaml file.

Test the installation with command:

helm install vmagent vm/victoria-metrics-agent -f values.yaml -n NAMESPACE --debug --dry-run

Install chart with command:

for helm v3

helm install vmagent vm/victoria-metrics-agent -f values.yaml -n NAMESPACE

Get the pods lists by running this commands:

kubectl get pods -A | grep 'agent'

Get the application by running this command:

helm list -f vmagent -n NAMESPACE

See the history of versions of vmagent application with command.

helm history vmagent -n NAMESPACE

How to uninstall

Remove application with command.

helm uninstall vmagent -n NAMESPACE

Documentation of Helm Chart

Install helm-docs following the instructions on this tutorial.

Generate docs with helm-docs command.

cd charts/victoria-metrics-agent

helm-docs

The markdown generation is entirely go template driven. The tool parses metadata from charts and generates a number of sub-templates that can be referenced in a template file (by default README.md.gotmpl). If no template file is provided, the tool has a default internal template that will generate a reasonably formatted README.

Parameters

The following tables lists the configurable parameters of the chart and their default values.

Change the values according to the need of the environment in victoria-metrics-agent/values.yaml file.

KeyTypeDefaultDescription
affinityobject{}
annotationsobject{}
config.global.scrape_intervalstring"10s"
config.scrape_configs[0].job_namestring"vmagent"
config.scrape_configs[0].static_configs[0].targets[0]string"localhost:8429"
config.scrape_configs[1].bearer_token_filestring"/var/run/secrets/kubernetes.io/serviceaccount/token"
config.scrape_configs[1].job_namestring"kubernetes-apiservers"
config.scrape_configs[1].kubernetes_sd_configs[0].rolestring"endpointslices"
config.scrape_configs[1].relabel_configs[0].actionstring"keep"
config.scrape_configs[1].relabel_configs[0].regexstring"default;kubernetes;https"
config.scrape_configs[1].relabel_configs[0].source_labels[0]string"__meta_kubernetes_namespace"
config.scrape_configs[1].relabel_configs[0].source_labels[1]string"__meta_kubernetes_service_name"
config.scrape_configs[1].relabel_configs[0].source_labels[2]string"__meta_kubernetes_endpoint_port_name"
config.scrape_configs[1].schemestring"https"
config.scrape_configs[1].tls_config.ca_filestring"/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
config.scrape_configs[1].tls_config.insecure_skip_verifybooltrue
config.scrape_configs[2].bearer_token_filestring"/var/run/secrets/kubernetes.io/serviceaccount/token"
config.scrape_configs[2].job_namestring"kubernetes-nodes"
config.scrape_configs[2].kubernetes_sd_configs[0].rolestring"node"
config.scrape_configs[2].relabel_configs[0].actionstring"labelmap"
config.scrape_configs[2].relabel_configs[0].regexstring"__meta_kubernetes_node_label_(.+)"
config.scrape_configs[2].relabel_configs[1].replacementstring"kubernetes.default.svc:443"
config.scrape_configs[2].relabel_configs[1].target_labelstring"__address__"
config.scrape_configs[2].relabel_configs[2].regexstring"(.+)"
config.scrape_configs[2].relabel_configs[2].replacementstring"/api/v1/nodes/$1/proxy/metrics"
config.scrape_configs[2].relabel_configs[2].source_labels[0]string"__meta_kubernetes_node_name"
config.scrape_configs[2].relabel_configs[2].target_labelstring"__metrics_path__"
config.scrape_configs[2].schemestring"https"
config.scrape_configs[2].tls_config.ca_filestring"/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
config.scrape_configs[2].tls_config.insecure_skip_verifybooltrue
config.scrape_configs[3].bearer_token_filestring"/var/run/secrets/kubernetes.io/serviceaccount/token"
config.scrape_configs[3].job_namestring"kubernetes-nodes-cadvisor"
config.scrape_configs[3].kubernetes_sd_configs[0].rolestring"node"
config.scrape_configs[3].relabel_configs[0].actionstring"labelmap"
config.scrape_configs[3].relabel_configs[0].regexstring"__meta_kubernetes_node_label_(.+)"
config.scrape_configs[3].relabel_configs[1].replacementstring"kubernetes.default.svc:443"
config.scrape_configs[3].relabel_configs[1].target_labelstring"__address__"
config.scrape_configs[3].relabel_configs[2].regexstring"(.+)"
config.scrape_configs[3].relabel_configs[2].replacementstring"/api/v1/nodes/$1/proxy/metrics/cadvisor"
config.scrape_configs[3].relabel_configs[2].source_labels[0]string"__meta_kubernetes_node_name"
config.scrape_configs[3].relabel_configs[2].target_labelstring"__metrics_path__"
config.scrape_configs[3].schemestring"https"
config.scrape_configs[3].tls_config.ca_filestring"/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
config.scrape_configs[3].tls_config.insecure_skip_verifybooltrue
config.scrape_configs[4].job_namestring"kubernetes-service-endpoints"
config.scrape_configs[4].kubernetes_sd_configs[0].rolestring"endpointslices"
config.scrape_configs[4].relabel_configs[0].actionstring"drop"
config.scrape_configs[4].relabel_configs[0].regexbooltrue
config.scrape_configs[4].relabel_configs[0].source_labels[0]string"__meta_kubernetes_pod_container_init"
config.scrape_configs[4].relabel_configs[10].source_labels[0]string"__meta_kubernetes_service_name"
config.scrape_configs[4].relabel_configs[10].target_labelstring"service"
config.scrape_configs[4].relabel_configs[11].replacementstring"${1}"
config.scrape_configs[4].relabel_configs[11].source_labels[0]string"__meta_kubernetes_service_name"
config.scrape_configs[4].relabel_configs[11].target_labelstring"job"
config.scrape_configs[4].relabel_configs[12].actionstring"replace"
config.scrape_configs[4].relabel_configs[12].source_labels[0]string"__meta_kubernetes_pod_node_name"
config.scrape_configs[4].relabel_configs[12].target_labelstring"node"
config.scrape_configs[4].relabel_configs[1].actionstring"keep_if_equal"
config.scrape_configs[4].relabel_configs[1].source_labels[0]string"__meta_kubernetes_service_annotation_prometheus_io_port"
config.scrape_configs[4].relabel_configs[1].source_labels[1]string"__meta_kubernetes_pod_container_port_number"
config.scrape_configs[4].relabel_configs[2].actionstring"keep"
config.scrape_configs[4].relabel_configs[2].regexbooltrue
config.scrape_configs[4].relabel_configs[2].source_labels[0]string"__meta_kubernetes_service_annotation_prometheus_io_scrape"
config.scrape_configs[4].relabel_configs[3].actionstring"replace"
config.scrape_configs[4].relabel_configs[3].regexstring"(https?)"
config.scrape_configs[4].relabel_configs[3].source_labels[0]string"__meta_kubernetes_service_annotation_prometheus_io_scheme"
config.scrape_configs[4].relabel_configs[3].target_labelstring"__scheme__"
config.scrape_configs[4].relabel_configs[4].actionstring"replace"
config.scrape_configs[4].relabel_configs[4].regexstring"(.+)"
config.scrape_configs[4].relabel_configs[4].source_labels[0]string"__meta_kubernetes_service_annotation_prometheus_io_path"
config.scrape_configs[4].relabel_configs[4].target_labelstring"__metrics_path__"
config.scrape_configs[4].relabel_configs[5].actionstring"replace"
config.scrape_configs[4].relabel_configs[5].regexstring"([^:]+)(?::\\d+)?;(\\d+)"
config.scrape_configs[4].relabel_configs[5].replacementstring"$1:$2"
config.scrape_configs[4].relabel_configs[5].source_labels[0]string"__address__"
config.scrape_configs[4].relabel_configs[5].source_labels[1]string"__meta_kubernetes_service_annotation_prometheus_io_port"
config.scrape_configs[4].relabel_configs[5].target_labelstring"__address__"
config.scrape_configs[4].relabel_configs[6].actionstring"labelmap"
config.scrape_configs[4].relabel_configs[6].regexstring"__meta_kubernetes_service_label_(.+)"
config.scrape_configs[4].relabel_configs[7].source_labels[0]string"__meta_kubernetes_pod_name"
config.scrape_configs[4].relabel_configs[7].target_labelstring"pod"
config.scrape_configs[4].relabel_configs[8].source_labels[0]string"__meta_kubernetes_pod_container_name"
config.scrape_configs[4].relabel_configs[8].target_labelstring"container"
config.scrape_configs[4].relabel_configs[9].source_labels[0]string"__meta_kubernetes_namespace"
config.scrape_configs[4].relabel_configs[9].target_labelstring"namespace"
config.scrape_configs[5].job_namestring"kubernetes-service-endpoints-slow"
config.scrape_configs[5].kubernetes_sd_configs[0].rolestring"endpointslices"
config.scrape_configs[5].relabel_configs[0].actionstring"drop"
config.scrape_configs[5].relabel_configs[0].regexbooltrue
config.scrape_configs[5].relabel_configs[0].source_labels[0]string"__meta_kubernetes_pod_container_init"
config.scrape_configs[5].relabel_configs[10].source_labels[0]string"__meta_kubernetes_service_name"
config.scrape_configs[5].relabel_configs[10].target_labelstring"service"
config.scrape_configs[5].relabel_configs[11].replacementstring"${1}"
config.scrape_configs[5].relabel_configs[11].source_labels[0]string"__meta_kubernetes_service_name"
config.scrape_configs[5].relabel_configs[11].target_labelstring"job"
config.scrape_configs[5].relabel_configs[12].actionstring"replace"
config.scrape_configs[5].relabel_configs[12].source_labels[0]string"__meta_kubernetes_pod_node_name"
config.scrape_configs[5].relabel_configs[12].target_labelstring"node"
config.scrape_configs[5].relabel_configs[1].actionstring"keep_if_equal"
config.scrape_configs[5].relabel_configs[1].source_labels[0]string"__meta_kubernetes_service_annotation_prometheus_io_port"
config.scrape_configs[5].relabel_configs[1].source_labels[1]string"__meta_kubernetes_pod_container_port_number"
config.scrape_configs[5].relabel_configs[2].actionstring"keep"
config.scrape_configs[5].relabel_configs[2].regexbooltrue
config.scrape_configs[5].relabel_configs[2].source_labels[0]string"__meta_kubernetes_service_annotation_prometheus_io_scrape_slow"
config.scrape_configs[5].relabel_configs[3].actionstring"replace"
config.scrape_configs[5].relabel_configs[3].regexstring"(https?)"
config.scrape_configs[5].relabel_configs[3].source_labels[0]string"__meta_kubernetes_service_annotation_prometheus_io_scheme"
config.scrape_configs[5].relabel_configs[3].target_labelstring"__scheme__"
config.scrape_configs[5].relabel_configs[4].actionstring"replace"
config.scrape_configs[5].relabel_configs[4].regexstring"(.+)"
config.scrape_configs[5].relabel_configs[4].source_labels[0]string"__meta_kubernetes_service_annotation_prometheus_io_path"
config.scrape_configs[5].relabel_configs[4].target_labelstring"__metrics_path__"
config.scrape_configs[5].relabel_configs[5].actionstring"replace"
config.scrape_configs[5].relabel_configs[5].regexstring"([^:]+)(?::\\d+)?;(\\d+)"
config.scrape_configs[5].relabel_configs[5].replacementstring"$1:$2"
config.scrape_configs[5].relabel_configs[5].source_labels[0]string"__address__"
config.scrape_configs[5].relabel_configs[5].source_labels[1]string"__meta_kubernetes_service_annotation_prometheus_io_port"
config.scrape_configs[5].relabel_configs[5].target_labelstring"__address__"
config.scrape_configs[5].relabel_configs[6].actionstring"labelmap"
config.scrape_configs[5].relabel_configs[6].regexstring"__meta_kubernetes_service_label_(.+)"
config.scrape_conf

Deploy victoria-metrics-agent with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has victoria-metrics-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 chartvictoria-metrics-agent is pinned at v0.8.41 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