Type: application Version: 0.4.0 Artifact Hub Slack

Victoria Metrics Gateway - Auth & Rate-Limitting proxy for Victoria Metrics

Table of Content

Prerequisites #

  • Install the follow packages: git, kubectl, helm, helm-docs. See this tutorial.
  • PV support on underlying infrastructure

Chart Details #

This chart will do the following:

  • Rollout victoria metrics gateway

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-gateway chart available to installation:

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

Install victoria-metrics-gateway chart #

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

  • For HTTPS repository

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

    helm show values oci://ghcr.io/victoriametrics/helm-charts/victoria-metrics-gateway > 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 vmg vm/victoria-metrics-gateway -f values.yaml -n NAMESPACE --debug --dry-run
    
  • For OCI repository

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

Install chart with command:

  • For HTTPS repository

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

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

Get the pods lists by running this commands:

kubectl get pods -A | grep 'vmg'

Get the application by running this command:

helm list -f vmg -n NAMESPACE

See the history of versions of vmg application with command.

helm history vmg -n NAMESPACE

How to use JWT signature verification

Kubernetes best-practice is to store sensitive configuration parts in secrets. For example, 2 keys will be stored as:

apiVersion: v1
data:
  key: "<<KEY_DATA>>"
kind: Secret
metadata:
  name: key1
---
apiVersion: v1
data:
  key: "<<KEY_DATA>>"
kind: Secret
metadata:
  name: key2

In order to use those secrets it is needed to:

  • mount secrets into pod
  • provide flag pointing to secret on disk

Here is an example values.yml file configuration to achieve this:

auth:
  enable: true

extraVolumes:
  - name: key1
    secret:
      secretName: key1
  - name: key2
    secret:
      secretName: key2

extraVolumeMounts:
  - name: key1
    mountPath: /key1
  - name: key2
    mountPath: /key2

extraArgs:
  envflag.enable: "true"
  envflag.prefix: VM_
  loggerFormat: json
  auth.publicKeyFiles: "/key1/key,/key2/key"

Note that in this configuration all secret keys will be mounted and accessible to pod. Please, refer to this doc to see all available secret source options.

How to uninstall #

Remove application with command.

helm uninstall vmg -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-gateway

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-gateway/values.yaml file.

KeyTypeDefaultDescription
affinityobject
{}

Affinity configurations

annotationsobject
{}

Annotations to be added to the deployment

authobject
enabled: false

Access Control configuration. https://docs.victoriametrics.com/vmgateway#access-control

auth.enabledbool
false

Enable/Disable access-control

clusterModebool
false

Specify to True if the source for rate-limiting, reading and writing as a VictoriaMetrics Cluster. Must be true for rate limiting

configMapstring
""

Use existing configmap if specified otherwise .config values will be used. Ref: https://docs.victoriametrics.com/vmgateway

containerWorkingDirstring
/
envlist
[]

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

envFromlist
[]
extraArgs."envflag.enable"string
"true"
extraArgs."envflag.prefix"string
VM_
extraArgs.loggerFormatstring
json
extraContainerslist
[]
extraHostPathMountslist
[]

Additional hostPath mounts

extraVolumeMountslist
[]

Extra Volume Mounts for the container

extraVolumeslist
[]

Extra Volumes for the pod

fullnameOverridestring
""
global.compatibility.openshift.adaptSecurityContextstring
auto
global.image.registrystring
""
global.imagePullSecretslist
[]
image.pullPolicystring
IfNotPresent

Pull policy of Docker image

image.registrystring
""

Victoria Metrics gateway Docker registry

image.repositorystring
victoriametrics/vmgateway

Victoria Metrics gateway Docker repository and image name

image.tagstring
""

Tag of Docker image override Chart.AppVersion

image.variantstring
""
imagePullSecretslist
[]
ingress.annotationsobject
{}
ingress.enabledbool
false
ingress.extraLabelsobject
{}
ingress.hostslist
[]
ingress.pathTypestring
Prefix

pathType is only for k8s >= 1.1=

ingress.tlslist
[]
licenseobject
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.keystring
""

License key

license.secretobject
key: ""
name: ""

Use existing secret with license key

license.secret.keystring
""

Key in secret with license key

license.secret.namestring
""

Existing secret name

nameOverridestring
""
nodeSelectorobject
{}

NodeSelector configurations. Ref: https://kubernetes.io/docs/user-guide/node-selection/

podAnnotationsobject
{}

Annotations to be added to pod

podDisruptionBudgetobject
enabled: false
labels: {}

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

podSecurityContext.enabledbool
true
probe.livenessobject
initialDelaySeconds: 5
periodSeconds: 15
tcpSocket: {}
timeoutSeconds: 5

liveness probe

probe.readinessobject
httpGet: {}
initialDelaySeconds: 5
periodSeconds: 15

readiness probe

probe.startupobject
{}

startup probe

rateLimiterobject
config: {}
datasource:
    url: ""
enabled: false

Rate limiter configuration. Docs https://docs.victoriametrics.com/vmgateway#rate-limiter

rateLimiter.datasource.urlstring
""

Datasource VictoriaMetrics or vmselects. Required. Example http://victoroametrics:8428 or http://vmselect:8481/select/0/prometheus

rateLimiter.enabledbool
false

Enable/Disable rate-limiting

read.urlstring
""

Read endpoint without suffixes, victoriametrics or vmselect. Example http://victoroametrics:8428 or http://vmselect:8481

replicaCountint
1

Number of replicas of vmgateway

resourcesobject
{}

We usually recommend not to specify default resources and to leave this as a conscious choice for the user. This also increases chances charts run on environments with little resources, such as Minikube. If you do want to specify resources, uncomment the following lines, adjust them as necessary, and remove the curly braces after ‘resources:’.

securityContextobject
enabled: true
runAsGroup: 1000
runAsNonRoot: true
runAsUser: 1000

Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/

service.annotationsobject
{}
service.clusterIPstring
""
service.enabledbool
true
service.externalIPslist
[]
service.extraLabelsobject
{}
service.ipFamilieslist
[]
service.ipFamilyPolicystring
""
service.loadBalancerIPstring
""
service.loadBalancerSourceRangeslist
[]
service.servicePortint
8431
service.typestring
ClusterIP
serviceAccount.annotationsobject
{}

Annotations to add to the service account

serviceAccount.createbool
true

Specifies whether a service account should be created

serviceAccount.namestring
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.annotationsobject
{}

Service Monitor annotations

serviceMonitor.basicAuthobject
{}

Basic auth params for Service Monitor

serviceMonitor.enabledbool
false

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

serviceMonitor.extraLabelsobject
{}

Service Monitor labels

serviceMonitor.metricRelabelingslist
[]

Service Monitor metricRelabelings

serviceMonitor.relabelingslist
[]

Service Monitor relabelings

tolerationslist
[]

Tolerations configurations. Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/

write.urlstring
""

Write endpoint without suffixes, victoriametrics or vminsert. Example http://victoroametrics:8428 or http://vminsert:8480