Back to Charts

prometheus-redis-exporter

stable/prometheus-redis-exporter/README.md

latest8.2 KB
Original Source

prometheus-redis-exporter

DEPRECATED and moved to https://github.com/prometheus-community/helm-charts

redis_exporter is a Prometheus exporter for Redis metrics.

TL;DR;

bash
$ helm install stable/prometheus-redis-exporter

Introduction

This chart bootstraps a redis_exporter deployment on a Kubernetes cluster using the Helm package manager.

Prerequisites

  • Kubernetes 1.10+ with Beta APIs enabled

Installing the Chart

To install the chart with the release name my-release:

bash
$ helm install --name my-release stable/prometheus-redis-exporter

The command deploys prometheus-redis-exporter on the Kubernetes cluster in the default configuration.

Uninstalling the Chart

To uninstall/delete the my-release deployment:

bash
$ helm delete my-release

The command removes all the Kubernetes components associated with the chart and deletes the release.

Configuration

The following table lists the configurable parameters and their default values.

ParameterDescriptionDefault
replicaCountdesired number of prometheus-redis-exporter pods1
image.repositoryprometheus-redis-exporter image repositoryoliver006/redis_exporter
image.tagprometheus-redis-exporter image tagv1.3.4
image.pullPolicyimage pull policyIfNotPresent
image.pullSecretsimage pull secrets{}
extraArgsextra arguments for the binary; possible values here{}
envadditional environment variables in YAML format. Can be used to pass credentials as env variables (via secret) as per the image readme here{}
resourcescpu/memory resource requests/limits{}
tolerationstoleration labels for pod assignment{}
affinityaffinity settings for pod assignment{}
service.typedesired service typeClusterIP
service.portservice external port9121
service.annotationsCustom annotations for service{}
service.labelsAdditional custom labels for the service{}
redisAddressAddress of the Redis instance to scrape. Use rediss:// for SSL.redis://myredis:6379
annotationspod annotations for easier discovery{}
rbac.createSpecifies whether RBAC resources should be created.true
rbac.pspEnabledSpecifies whether a PodSecurityPolicy should be created.true
serviceAccount.createSpecifies whether a service account should be created.true
serviceAccount.nameName of the service account.
serviceMonitor.enabledUse servicemonitor from prometheus operatorfalse
serviceMonitor.namespaceNamespace this servicemonitor is installed in
serviceMonitor.intervalHow frequently Prometheus should scrape
serviceMonitor.telemetryPathPath to redis-exporter telemtery-path
serviceMonitor.labelsLabels for the servicemonitor passed to Prometheus Operator{}
serviceMonitor.timeoutTimeout after which the scrape is ended
serviceMonitor.targetLabelsSet of labels to transfer on the Kubernetes Service onto the target.
serviceMonitor.metricRelabelingsMetricRelabelConfigs to apply to samples before ingestion.
prometheusRule.enabledSet this to true to create prometheusRules for Prometheus operatorfalse
prometheusRule.additionalLabelsAdditional labels that can be used so prometheusRules will be discovered by Prometheus{}
prometheusRule.namespacenamespace where prometheusRules resource should be created
prometheusRule.rulesrules to be created, check values for an example.[]
script.configmapLet you run a custom lua script from a configmap. The corresponding environment variable REDIS_EXPORTER_SCRIPT will be set automatically
script.keynameName of the key inside configmap which contains your script
auth.enabledSpecifies whether redis uses authenticationfalse
auth.secret.nameName of existing redis secret (ignores redisPassword)
auth.secret.keyName of key containing password to be retrieved from the existing secret
auth.redisPasswordRedis password (when not stored in a secret)

For more information please refer to the redis_exporter documentation.

Specify each parameter using the --set key=value[,key=value] argument to helm install. For example,

bash
$ helm install --name my-release \
  --set "redisAddress=redis://myredis:6379" \
    stable/prometheus-redis-exporter

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

bash
$ helm install --name my-release -f values.yaml stable/prometheus-redis-exporter

Using a custom LUA-Script

First, you need to deploy the script with a configmap. This is an example script from mentioned in the redis_exporter-image repository

yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: prometheus-redis-exporter-script
data:
  script: |-
    -- Example collect script for -script option
    -- This returns a Lua table with alternating keys and values.
    -- Both keys and values must be strings, similar to a HGETALL result.
    -- More info about Redis Lua scripting: https://redis.io/commands/eval

    local result = {}

    -- Add all keys and values from some hash in db 5
    redis.call("SELECT", 5)
    local r = redis.call("HGETALL", "some-hash-with-stats")
    if r ~= nil then
        for _,v in ipairs(r) do
            table.insert(result, v) -- alternating keys and values
        end
    end

    -- Set foo to 42
    table.insert(result, "foo")
    table.insert(result, "42") -- note the string, use tostring() if needed

    return result

If you want to use this script for collecting metrics, you could do this by just set script.configmap to the name of the configmap (e.g. prometheus-redis-exporter-script) and script.keyname to the configmap-key holding the script (eg. script). The required variables inside the container will be set automatically.

Upgrading

To 3.0.1

The default tag for the exporter image is now v1.x.x. This major release includes changes to the names of various metrics and no longer directly supports the configuration (and scraping) of multiple redis instances; that is now the Prometheus server's responsibility. You'll want to use this dashboard now. Please see the redis_exporter github page for more details.