Download this Image
The image is available on cgr.dev
:
docker pull cgr.dev/chainguard/victoriametrics:latest
VictoriaMetrics can be deployed as a single node (all image tags without a "-cluster" suffix) or as a distributed cluster. See the github repository for reference: https://github.com/VictoriaMetrics/VictoriaMetrics/tree/master as well as their public facing documentation: https://docs.victoriametrics.com/
In clustered mode, the VictoriaMetrics application itself is broken into 3 different services:
- vmstorage - stores the raw data and returns the queried data on the given time range for the given label filters
- vminsert - accepts the ingested data and spreads it among vmstorage nodes according to consistent hashing over metric name and all its labels
- vmselect - performs incoming queries by fetching the needed data from all the configured vmstorage nodes
- vmalert - executes a list of given alerting / monitoring rules against Prometheus HTTP API
This image group also contains several standalone services (that DO vary between clustered and single mode):
- vmagent - A lightweight metrics collection agent.
- vmauth - A service that provides authentication and authorization for VictoriaMetrics services. It acts as HTTP proxy, which can authorize, route and load balance requests across VictoriaMetrics components or any other HTTP backends.
Usage
You can install the VictoriaMetrics components using Helm. Below are the Helm install commands for each component:
Install vmagent
helm install vmagent victoria-metrics-agent --repo https://victoriametrics.github.io/helm-charts/ \
--namespace victoriametrics \
--set image.repository=cgr.dev/chainguard-private/victoriametrics-vmagent \
--set image.tag=latest
Install vmauth
helm install vmauth victoria-metrics-auth --repo https://victoriametrics.github.io/helm-charts/ \
--namespace victoriametrics \
--set image.repository=cgr.dev/chainguard-private/victoriametrics-vmauth \
--set image.tag=latest
Note: You will need to set the config and for sample testing purpose, you can take inspiration from this example:
cat <<YAML | kubectl apply -f -
apiVersion: v1
kind: ConfigMap
metadata:
name: vmauth-config
namespace: victoriametrics
data:
auth.yml: |
users:
- username: "user1"
password: "pass1"
url_prefix: "http://localhost:8428/"
- username: "user2"
password: "pass2"
url_prefix: "http://localhost:8429/"
unauthorized_user:
url_prefix: "http://localhost:8428/"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: vmauth
namespace: victoriametrics
spec:
selector:
matchLabels:
app: vmauth
template:
metadata:
labels:
app: vmauth
spec:
containers:
- name: vmauth
image: cgr.dev/chainguard-private/victoriametrics-vmauth:latest
args:
- "-auth.config=/config/auth.yml"
ports:
- containerPort: 8427
volumeMounts:
- name: vmauth-config
mountPath: /config
volumes:
- name: vmauth-config
configMap:
name: vmauth-config
YAML
Install vminsert
, vmselect
, vmstorage
helm install vminsert victoria-metrics-cluster --repo https://victoriametrics.github.io/helm-charts/ \
--namespace victoriametrics-cluster \
--set vminsert.image.repository=cgr.dev/chainguard-private/victoriametrics-vminsert \
--set vminsert.image.tag=latest \
--set vminsert.image.variant="" \
--set vmselect.image.repository=cgr.dev/chainguard-private/victoriametrics-vmselect \
--set vmselect.image.tag=latest \
--set vmselect.image.variant="" \
--set vmstorage.image.repository=cgr.dev/chainguard-private/victoriametrics-vmstorage \
--set vmstorage.image.tag=latest \
--set vmstorage.image.variant=""
Note: We use vmstorage.image.variant=""
because our images are alredy coming with cluster
suffix, so we no longer need to specify it. For further reference, refer to official docs
Install vmalert
You can use this example and override the image to
use chainguard images like shown below. Note the server.config is your alerting
rules, so you will have to customize those as per your own needs, as well as
other things that are pertinent to your own setup.
cat <<EOF > /tmp/helminstall
server:
datasource:
url: "your PROMETHEUS HTTP API server here"
image:
repository: cgr.dev/chainguard-private/victoriametrics-vmalert
tag: latest
notifier:
alertmanager:
url: http://localhost:9093
config:
alerts:
groups:
- name: common
rules:
- alert: instanceIsDown
for: 1m
expr: up == 0
labels:
severity: critical
annotations:
summary: "{{ $labels.job }} instance: {{$labels.instance }} is not up"
description: "Job {{ $labels.job }} instance: {{$labels.instance }} is not up for the last 1 minute"
EOF
helm install vmalert victoria-metrics-alert --namespace victoriametrics \
--create-namespace --repo https://victoriametrics.github.io/helm-charts/ \
-f /tmp/helminstall
helm install vminsert victoria-metrics-cluster --repo https://victoriametrics.github.io/helm-charts/ \
--namespace victoriametrics-cluster \
--set server.image.repository=cgr.dev/chainguard-private/victoriametrics-vmalert \
--set server.image.tag=latest \
--set server.image.variant=""
--set server.config="{...}"