VictoriaMetrics/docs/helm/victoria-metrics-agent/README.md
Github Actions 8f5e0ebbb4
Automatic update helm docs from VictoriaMetrics/helm-charts@f0e007f (#7059)
Automated changes by
[create-pull-request](https://github.com/peter-evans/create-pull-request)
GitHub action

Signed-off-by: Github Actions <133988544+victoriametrics-bot@users.noreply.github.com>
Co-authored-by: AndrewChubatiuk <3162380+AndrewChubatiuk@users.noreply.github.com>
2024-09-20 17:38:55 +02:00

29 KiB

Type: application Version: 0.12.2 Artifact Hub Slack

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.

Setup chart repository (can be omitted for OCI repositories)

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:

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

Install victoria-metrics-agent chart

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

  • For HTTPS repository

    helm show values vm/victoria-metrics-agent > values.yaml
    
  • For OCI repository

    helm show values oci://ghcr.io/victoriametrics/helm-charts/victoria-metrics-agent > values.yaml
    

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

Test the installation with command:

  • For HTTPS repository

    helm install vma vm/victoria-metrics-agent -f values.yaml -n NAMESPACE --debug --dry-run
    
  • For OCI repository

    helm install vma oci://ghcr.io/victoriametrics/helm-charts/victoria-metrics-agent -f values.yaml -n NAMESPACE --debug --dry-run
    

Install chart with command:

  • For HTTPS repository

    helm install vma vm/victoria-metrics-agent -f values.yaml -n NAMESPACE
    
  • For OCI repository

    helm install vma oci://ghcr.io/victoriametrics/helm-charts/victoria-metrics-agent -f values.yaml -n NAMESPACE
    

Get the pods lists by running this commands:

kubectl get pods -A | grep 'vma'

Get the application by running this command:

helm list -f vma -n NAMESPACE

See the history of versions of vma application with command.

helm history vma -n NAMESPACE

How to uninstall

Remove application with command.

helm uninstall vma -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
{}

Annotations to be added to the deployment

config.global.scrape_interval string
10s
config.scrape_configs list
- job_name: vmagent
  static_configs:
    - targets:
        - localhost:8429
- bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
  job_name: kubernetes-apiservers
  kubernetes_sd_configs:
    - role: endpoints
  relabel_configs:
    - action: keep
      regex: default;kubernetes;https
      source_labels:
        - __meta_kubernetes_namespace
        - __meta_kubernetes_service_name
        - __meta_kubernetes_endpoint_port_name
  scheme: https
  tls_config:
    ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
    insecure_skip_verify: true
- bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
  job_name: kubernetes-nodes
  kubernetes_sd_configs:
    - role: node
  relabel_configs:
    - action: labelmap
      regex: __meta_kubernetes_node_label_(.+)
    - replacement: kubernetes.default.svc:443
      target_label: __address__
    - regex: (.+)
      replacement: /api/v1/nodes/$1/proxy/metrics
      source_labels:
        - __meta_kubernetes_node_name
      target_label: __metrics_path__
  scheme: https
  tls_config:
    ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
    insecure_skip_verify: true
- bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
  honor_timestamps: false
  job_name: kubernetes-nodes-cadvisor
  kubernetes_sd_configs:
    - role: node
  relabel_configs:
    - action: labelmap
      regex: __meta_kubernetes_node_label_(.+)
    - replacement: kubernetes.default.svc:443
      target_label: __address__
    - regex: (.+)
      replacement: /api/v1/nodes/$1/proxy/metrics/cadvisor
      source_labels:
        - __meta_kubernetes_node_name
      target_label: __metrics_path__
  scheme: https
  tls_config:
    ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
    insecure_skip_verify: true
- job_name: kubernetes-service-endpoints
  kubernetes_sd_configs:
    - role: endpointslices
  relabel_configs:
    - action: drop
      regex: true
      source_labels:
        - __meta_kubernetes_pod_container_init
    - action: keep_if_equal
      source_labels:
        - __meta_kubernetes_service_annotation_prometheus_io_port
        - __meta_kubernetes_pod_container_port_number
    - action: keep
      regex: true
      source_labels:
        - __meta_kubernetes_service_annotation_prometheus_io_scrape
    - action: replace
      regex: (https?)
      source_labels:
        - __meta_kubernetes_service_annotation_prometheus_io_scheme
      target_label: __scheme__
    - action: replace
      regex: (.+)
      source_labels:
        - __meta_kubernetes_service_annotation_prometheus_io_path
      target_label: __metrics_path__
    - action: replace
      regex: ([^:]+)(?::\d+)?;(\d+)
      replacement: $1:$2
      source_labels:
        - __address__
        - __meta_kubernetes_service_annotation_prometheus_io_port
      target_label: __address__
    - action: labelmap
      regex: __meta_kubernetes_service_label_(.+)
    - source_labels:
        - __meta_kubernetes_pod_name
      target_label: pod
    - source_labels:
        - __meta_kubernetes_pod_container_name
      target_label: container
    - source_labels:
        - __meta_kubernetes_namespace
      target_label: namespace
    - source_labels:
        - __meta_kubernetes_service_name
      target_label: service
    - replacement: ${1}
      source_labels:
        - __meta_kubernetes_service_name
      target_label: job
    - action: replace
      source_labels:
        - __meta_kubernetes_pod_node_name
      target_label: node
- job_name: kubernetes-service-endpoints-slow
  kubernetes_sd_configs:
    - role: endpointslices
  relabel_configs:
    - action: drop
      regex: true
      source_labels:
        - __meta_kubernetes_pod_container_init
    - action: keep_if_equal
      source_labels:
        - __meta_kubernetes_service_annotation_prometheus_io_port
        - __meta_kubernetes_pod_container_port_number
    - action: keep
      regex: true
      source_labels:
        - __meta_kubernetes_service_annotation_prometheus_io_scrape_slow
    - action: replace
      regex: (https?)
      source_labels:
        - __meta_kubernetes_service_annotation_prometheus_io_scheme
      target_label: __scheme__
    - action: replace
      regex: (.+)
      source_labels:
        - __meta_kubernetes_service_annotation_prometheus_io_path
      target_label: __metrics_path__
    - action: replace
      regex: ([^:]+)(?::\d+)?;(\d+)
      replacement: $1:$2
      source_labels:
        - __address__
        - __meta_kubernetes_service_annotation_prometheus_io_port
      target_label: __address__
    - action: labelmap
      regex: __meta_kubernetes_service_label_(.+)
    - source_labels:
        - __meta_kubernetes_pod_name
      target_label: pod
    - source_labels:
        - __meta_kubernetes_pod_container_name
      target_label: container
    - source_labels:
        - __meta_kubernetes_namespace
      target_label: namespace
    - source_labels:
        - __meta_kubernetes_service_name
      target_label: service
    - replacement: ${1}
      source_labels:
        - __meta_kubernetes_service_name
      target_label: job
    - action: replace
      source_labels:
        - __meta_kubernetes_pod_node_name
      target_label: node
  scrape_interval: 5m
  scrape_timeout: 30s
- job_name: kubernetes-services
  kubernetes_sd_configs:
    - role: service
  metrics_path: /probe
  params:
    module:
        - http_2xx
  relabel_configs:
    - action: keep
      regex: true
      source_labels:
        - __meta_kubernetes_service_annotation_prometheus_io_probe
    - source_labels:
        - __address__
      target_label: __param_target
    - replacement: blackbox
      target_label: __address__
    - source_labels:
        - __param_target
      target_label: instance
    - action: labelmap
      regex: __meta_kubernetes_service_label_(.+)
    - source_labels:
        - __meta_kubernetes_namespace
      target_label: namespace
    - source_labels:
        - __meta_kubernetes_service_name
      target_label: service
- job_name: kubernetes-pods
  kubernetes_sd_configs:
    - role: pod
  relabel_configs:
    - action: drop
      regex: true
      source_labels:
        - __meta_kubernetes_pod_container_init
    - action: keep_if_equal
      source_labels:
        - __meta_kubernetes_pod_annotation_prometheus_io_port
        - __meta_kubernetes_pod_container_port_number
    - action: keep
      regex: true
      source_labels:
        - __meta_kubernetes_pod_annotation_prometheus_io_scrape
    - action: replace
      regex: (.+)
      source_labels:
        - __meta_kubernetes_pod_annotation_prometheus_io_path
      target_label: __metrics_path__
    - action: replace
      regex: ([^:]+)(?::\d+)?;(\d+)
      replacement: $1:$2
      source_labels:
        - __address__
        - __meta_kubernetes_pod_annotation_prometheus_io_port
      target_label: __address__
    - action: labelmap
      regex: __meta_kubernetes_pod_label_(.+)
    - source_labels:
        - __meta_kubernetes_pod_name
      target_label: pod
    - source_labels:
        - __meta_kubernetes_pod_container_name
      target_label: container
    - source_labels:
        - __meta_kubernetes_namespace
      target_label: namespace
    - action: replace
      source_labels:
        - __meta_kubernetes_pod_node_name
      target_label: node

scrape configuration. scrape self by default

configMap string
""

vmagent scraping configuration: https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/docs/vmagent.md#how-to-collect-metrics-in-prometheus-format use existing configmap if specified otherwise .config values will be used

containerWorkingDir string
/
deployment object
enabled: true
strategy: {}

ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/

emptyDir object
{}
env list
[]

Additional environment variables (ex.: secret tokens, flags) https://docs.victoriametrics.com/#environment-variables

envFrom list
[]
extraArgs object
envflag.enable: "true"
envflag.prefix: VM_
loggerFormat: json

vmagent extra command line arguments

extraContainers list
[]
extraHostPathMounts list
[]

Additional hostPath mounts

extraLabels object
{}

extra Labels for Pods, Deployment and Statefulset

extraObjects list
[]

Add extra specs dynamically to this chart

extraScrapeConfigs list
[]

Extra scrape configs that will be appended to config

extraVolumeMounts list
[]

Extra Volume Mounts for the container

extraVolumes list
[]

Extra Volumes for the pod

fullnameOverride string
""
global.compatibility.openshift.adaptSecurityContext string
auto
global.image.registry string
""
global.imagePullSecrets list
[]
horizontalPodAutoscaling object
enabled: false
maxReplicas: 10
metrics: []
minReplicas: 1

Horizontal Pod Autoscaling. Note that it is not intended to be used for vmagents which perform scraping. In order to scale scraping vmagents see: https://docs.victoriametrics.com/vmagent/#scraping-big-number-of-targets

horizontalPodAutoscaling.enabled bool
false

Use HPA for vmagent

horizontalPodAutoscaling.maxReplicas int
10

Maximum replicas for HPA to use to to scale vmagent

horizontalPodAutoscaling.metrics list
[]

Metric for HPA to use to scale vmagent

horizontalPodAutoscaling.minReplicas int
1

Minimum replicas for HPA to use to scale vmagent

image.pullPolicy string
IfNotPresent
image.registry string
""

Image registry

image.repository string
victoriametrics/vmagent

Image repository

image.tag string
""

Image tag, set to Chart.AppVersion by default

image.variant string
""

Variant of the image to use. e.g. enterprise, scratch

imagePullSecrets list
[]
ingress.annotations object
{}
ingress.enabled bool
false
ingress.extraLabels object
{}
ingress.hosts list
[]
ingress.pathType string
Prefix

pathType is only for k8s >= 1.1=

ingress.tls list
[]
initContainers list
[]
license object
key: ""
secret:
    key: ""
    name: ""

Enterprise license key configuration for VictoriaMetrics enterprise. Required only for VictoriaMetrics enterprise. Documentation - https://docs.victoriametrics.com/enterprise, for more information, visit https://victoriametrics.com/products/enterprise/ . To request a trial license, go to https://victoriametrics.com/products/enterprise/trial/ Supported starting from VictoriaMetrics v1.94.0

license.key string
""

License key

license.secret object
key: ""
name: ""

Use existing secret with license key

license.secret.key string
""

Key in secret with license key

license.secret.name string
""

Existing secret name

multiTenantUrls list
[]
nameOverride string
""
nodeSelector object
{}
persistence.accessModes[0] string
ReadWriteOnce
persistence.annotations object
{}
persistence.enabled bool
false
persistence.existingClaim string
""
persistence.extraLabels object
{}
persistence.matchLabels object
{}

Bind Persistent Volume by labels. Must match all labels of targeted PV.

persistence.size string
10Gi
podAnnotations object
{}

Annotations to be added to pod

podDisruptionBudget object
enabled: false
labels: {}

See kubectl explain poddisruptionbudget.spec for more ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/

podLabels object
{}

extra Labels for Pods only

podSecurityContext.enabled bool
true
priorityClassName string
""

priority class to be assigned to the pod(s)

probe.liveness object
initialDelaySeconds: 5
periodSeconds: 15
tcpSocket: {}
timeoutSeconds: 5

liveness probe

probe.readiness object
httpGet: {}
initialDelaySeconds: 5
periodSeconds: 15

readiness probe

probe.startup object
{}

startup probe

rbac.annotations object
{}
rbac.create bool
true
rbac.extraLabels object
{}
rbac.namespaced bool
false

if true and rbac.enabled, will deploy a Role/Rolebinding instead of a ClusterRole/ClusterRoleBinding

remoteWriteUrls list
[]

WARN: need to specify at least one remote write url or one multi tenant url

replicaCount int
1
resources object
{}
securityContext.enabled bool
true
service.annotations object
{}
service.clusterIP string
""
service.enabled bool
false
service.externalIPs list
[]
service.externalTrafficPolicy string
""
service.extraLabels object
{}
service.healthCheckNodePort string
""
service.ipFamilies list
[]
service.ipFamilyPolicy string
""
service.loadBalancerIP string
""
service.loadBalancerSourceRanges list
[]
service.servicePort int
8429
service.type string
ClusterIP
serviceAccount.annotations object
{}

Annotations to add to the service account

serviceAccount.create bool
true

Specifies whether a service account should be created

serviceAccount.name string
null

The name of the service account to use. If not set and create is true, a name is generated using the fullname template

serviceMonitor.annotations object
{}

Service Monitor annotations

serviceMonitor.basicAuth object
{}

Basic auth params for Service Monitor

serviceMonitor.enabled bool
false

Enable deployment of Service Monitor for server component. This is Prometheus operator object

serviceMonitor.extraLabels object
{}

Service Monitor labels

serviceMonitor.metricRelabelings list
[]

Service Monitor metricRelabelings

serviceMonitor.relabelings list
[]

Service Monitor relabelings

statefulset object
clusterMode: false
enabled: false
replicationFactor: 1
updateStrategy: {}

ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/

statefulset.clusterMode bool
false

create cluster of vmagents. See https://docs.victoriametrics.com/vmagent#scraping-big-number-of-targets available since 1.77.2 version https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.77.2

statefulset.replicationFactor int
1

replication factor for vmagent in cluster mode

tolerations list
[]
topologySpreadConstraints list
[]