victoria-metrics-agent
by apecloud
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.
| Key | Type | Default | Description |
|---|---|---|---|
| affinity | object | {} | |
| annotations | object | {} | |
| config.global.scrape_interval | string | "10s" | |
| config.scrape_configs[0].job_name | string | "vmagent" | |
| config.scrape_configs[0].static_configs[0].targets[0] | string | "localhost:8429" | |
| config.scrape_configs[1].bearer_token_file | string | "/var/run/secrets/kubernetes.io/serviceaccount/token" | |
| config.scrape_configs[1].job_name | string | "kubernetes-apiservers" | |
| config.scrape_configs[1].kubernetes_sd_configs[0].role | string | "endpointslices" | |
| config.scrape_configs[1].relabel_configs[0].action | string | "keep" | |
| config.scrape_configs[1].relabel_configs[0].regex | string | "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].scheme | string | "https" | |
| config.scrape_configs[1].tls_config.ca_file | string | "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" | |
| config.scrape_configs[1].tls_config.insecure_skip_verify | bool | true | |
| config.scrape_configs[2].bearer_token_file | string | "/var/run/secrets/kubernetes.io/serviceaccount/token" | |
| config.scrape_configs[2].job_name | string | "kubernetes-nodes" | |
| config.scrape_configs[2].kubernetes_sd_configs[0].role | string | "node" | |
| config.scrape_configs[2].relabel_configs[0].action | string | "labelmap" | |
| config.scrape_configs[2].relabel_configs[0].regex | string | "__meta_kubernetes_node_label_(.+)" | |
| config.scrape_configs[2].relabel_configs[1].replacement | string | "kubernetes.default.svc:443" | |
| config.scrape_configs[2].relabel_configs[1].target_label | string | "__address__" | |
| config.scrape_configs[2].relabel_configs[2].regex | string | "(.+)" | |
| config.scrape_configs[2].relabel_configs[2].replacement | string | "/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_label | string | "__metrics_path__" | |
| config.scrape_configs[2].scheme | string | "https" | |
| config.scrape_configs[2].tls_config.ca_file | string | "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" | |
| config.scrape_configs[2].tls_config.insecure_skip_verify | bool | true | |
| config.scrape_configs[3].bearer_token_file | string | "/var/run/secrets/kubernetes.io/serviceaccount/token" | |
| config.scrape_configs[3].job_name | string | "kubernetes-nodes-cadvisor" | |
| config.scrape_configs[3].kubernetes_sd_configs[0].role | string | "node" | |
| config.scrape_configs[3].relabel_configs[0].action | string | "labelmap" | |
| config.scrape_configs[3].relabel_configs[0].regex | string | "__meta_kubernetes_node_label_(.+)" | |
| config.scrape_configs[3].relabel_configs[1].replacement | string | "kubernetes.default.svc:443" | |
| config.scrape_configs[3].relabel_configs[1].target_label | string | "__address__" | |
| config.scrape_configs[3].relabel_configs[2].regex | string | "(.+)" | |
| config.scrape_configs[3].relabel_configs[2].replacement | string | "/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_label | string | "__metrics_path__" | |
| config.scrape_configs[3].scheme | string | "https" | |
| config.scrape_configs[3].tls_config.ca_file | string | "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" | |
| config.scrape_configs[3].tls_config.insecure_skip_verify | bool | true | |
| config.scrape_configs[4].job_name | string | "kubernetes-service-endpoints" | |
| config.scrape_configs[4].kubernetes_sd_configs[0].role | string | "endpointslices" | |
| config.scrape_configs[4].relabel_configs[0].action | string | "drop" | |
| config.scrape_configs[4].relabel_configs[0].regex | bool | true | |
| 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_label | string | "service" | |
| config.scrape_configs[4].relabel_configs[11].replacement | string | "${1}" | |
| config.scrape_configs[4].relabel_configs[11].source_labels[0] | string | "__meta_kubernetes_service_name" | |
| config.scrape_configs[4].relabel_configs[11].target_label | string | "job" | |
| config.scrape_configs[4].relabel_configs[12].action | string | "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_label | string | "node" | |
| config.scrape_configs[4].relabel_configs[1].action | string | "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].action | string | "keep" | |
| config.scrape_configs[4].relabel_configs[2].regex | bool | true | |
| 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].action | string | "replace" | |
| config.scrape_configs[4].relabel_configs[3].regex | string | "(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_label | string | "__scheme__" | |
| config.scrape_configs[4].relabel_configs[4].action | string | "replace" | |
| config.scrape_configs[4].relabel_configs[4].regex | string | "(.+)" | |
| 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_label | string | "__metrics_path__" | |
| config.scrape_configs[4].relabel_configs[5].action | string | "replace" | |
| config.scrape_configs[4].relabel_configs[5].regex | string | "([^:]+)(?::\\d+)?;(\\d+)" | |
| config.scrape_configs[4].relabel_configs[5].replacement | string | "$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_label | string | "__address__" | |
| config.scrape_configs[4].relabel_configs[6].action | string | "labelmap" | |
| config.scrape_configs[4].relabel_configs[6].regex | string | "__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_label | string | "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_label | string | "container" | |
| config.scrape_configs[4].relabel_configs[9].source_labels[0] | string | "__meta_kubernetes_namespace" | |
| config.scrape_configs[4].relabel_configs[9].target_label | string | "namespace" | |
| config.scrape_configs[5].job_name | string | "kubernetes-service-endpoints-slow" | |
| config.scrape_configs[5].kubernetes_sd_configs[0].role | string | "endpointslices" | |
| config.scrape_configs[5].relabel_configs[0].action | string | "drop" | |
| config.scrape_configs[5].relabel_configs[0].regex | bool | true | |
| 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_label | string | "service" | |
| config.scrape_configs[5].relabel_configs[11].replacement | string | "${1}" | |
| config.scrape_configs[5].relabel_configs[11].source_labels[0] | string | "__meta_kubernetes_service_name" | |
| config.scrape_configs[5].relabel_configs[11].target_label | string | "job" | |
| config.scrape_configs[5].relabel_configs[12].action | string | "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_label | string | "node" | |
| config.scrape_configs[5].relabel_configs[1].action | string | "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].action | string | "keep" | |
| config.scrape_configs[5].relabel_configs[2].regex | bool | true | |
| 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].action | string | "replace" | |
| config.scrape_configs[5].relabel_configs[3].regex | string | "(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_label | string | "__scheme__" | |
| config.scrape_configs[5].relabel_configs[4].action | string | "replace" | |
| config.scrape_configs[5].relabel_configs[4].regex | string | "(.+)" | |
| 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_label | string | "__metrics_path__" | |
| config.scrape_configs[5].relabel_configs[5].action | string | "replace" | |
| config.scrape_configs[5].relabel_configs[5].regex | string | "([^:]+)(?::\\d+)?;(\\d+)" | |
| config.scrape_configs[5].relabel_configs[5].replacement | string | "$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_label | string | "__address__" | |
| config.scrape_configs[5].relabel_configs[6].action | string | "labelmap" | |
| config.scrape_configs[5].relabel_configs[6].regex | string | "__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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartvictoria-metrics-agent is pinned at v0.8.41 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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