[stable/redis-ha] Add Optional Prometheus Exporter Sidecar (#11085)

* [stable/redis-ha] Add Optional Prometheus Exporter Sidecar

Added support for an optional prometheus exporter sidecar container in each redis pod.

Signed-off-by: Tim Mitrovich <tim@mitrovich.net>

* [stable/redis-ha] Add Optional Prometheus Exporter Sidecar

* Added https://github.com/oliver006/redis_exporter to the sources list
* Added ability to configure resource limits
* Added ability to pull redis password from the existing redis secret so that we don't have plain text passwords in the config files
* Added ability to configure port and metrics scraping path
* Updated comments about the default install of redis-ha chart
* Added livenessProbe to exporter container

Signed-off-by: Tim Mitrovich <tim@mitrovich.net>
This commit is contained in:
Tim Mitrovich
2019-02-06 17:24:28 -08:00
committed by Kubernetes Prow Robot
parent 71e20cfd54
commit df256c332a
4 changed files with 66 additions and 4 deletions
+2 -1
View File
@@ -5,7 +5,7 @@ keywords:
- redis
- keyvalue
- database
version: 3.1.3
version: 3.1.4
appVersion: 5.0.3
description: Highly available Kubernetes implementation of Redis
icon: https://upload.wikimedia.org/wikipedia/en/thumb/6/6b/Redis_Logo.svg/1200px-Redis_Logo.svg.png
@@ -18,3 +18,4 @@ details:
sources:
- https://redis.io/download
- https://github.com/scality/Zenko/tree/development/1.0/kubernetes/zenko/charts/redis-ha
- https://github.com/oliver006/redis_exporter
+7 -3
View File
@@ -9,8 +9,8 @@ $ helm install stable/redis-ha
```
By default this chart install 3 pods total:
* one pod containing a redis master and sentinel containers
* two pods each containing redis slave and sentinel containers.
* one pod containing a redis master and sentinel container (optional prometheus metrics exporter sidecar available)
* two pods each containing a redis slave and sentinel containers (optional prometheus metrics exporter sidecars available)
## Introduction
@@ -73,7 +73,11 @@ The following table lists the configurable parameters of the Redis chart and the
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `tolerations` | Toleration labels for pod assignment | `[]` |
| `podAntiAffinity.server` | Antiaffinity for pod assignment of servers, `hard` or `soft` | `Hard node and soft zone anti-affinity` |
| `exporter.enabled` | If `true`, the prometheus exporter sidecar is enabled | `false` |
| `exporter.image` | Exporter image | `oliver006/redis_exporter` |
| `exporter.tag` | Exporter tag | `v0.28.0` |
| `exporter.annotations` | Prometheus scrape annotations | `{prometheus.io/path: /metrics, prometheus.io/port: "9121", prometheus.io/scrape: "true"}` |
| `exporter.extraArgs` | Additional args for the exporter | `{}` |
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
@@ -22,6 +22,11 @@ spec:
{{- if .Values.podAnnotations }}
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
{{- if .Values.exporter.enabled }}
prometheus.io/port: "{{ .Values.exporter.port }}"
prometheus.io/scrape: "true"
prometheus.io/path: {{ .Values.exporter.scrapePath }}
{{- end }}
labels:
release: {{ .Release.Name }}
app: {{ template "redis-ha.name" . }}
@@ -147,6 +152,41 @@ spec:
name: data
- mountPath: /probes
name: probes
{{- if .Values.exporter.enabled }}
- name: redis-exporter
image: "{{ .Values.exporter.image }}:{{ .Values.exporter.tag }}"
imagePullPolicy: {{ .Values.exporter.pullPolicy }}
args:
{{- range $key, $value := .Values.extraArgs }}
- --{{ $key }}={{ $value }}
{{- end }}
env:
- name: REDIS_ADDR
value: redis://localhost:6379
{{- if .Values.auth }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
{{- if .Values.existingSecret }}
name: {{ .Values.existingSecret }}
{{- else }}
name: {{ template "redis-ha.fullname" . }}
{{- end }}
key: auth
{{- end }}
livenessProbe:
httpGet:
path: {{ .Values.exporter.scrapePath }}
port: {{ .Values.exporter.port }}
initialDelaySeconds: 15
timeoutSeconds: 1
periodSeconds: 15
resources:
{{ toYaml .Values.exporter.resources | indent 10 }}
ports:
- name: exporter-port
containerPort: {{ .Values.exporter.port }}
{{- end }}
volumes:
- name: config
configMap:
+17
View File
@@ -91,6 +91,23 @@ affinity: |
release: {{ .Release.Name }}
topologyKey: failure-domain.beta.kubernetes.io/zone
# Prometheus exporter specific configuration options
exporter:
enabled: false
image: oliver006/redis_exporter
tag: v0.28.0
pullPolicy: IfNotPresent
# prometheus port & scrape path
port: 9121
scrapePath: /metrics
# cpu/memory resource limits/requests
resources: {}
# Additional args for redis exporter
extraArgs: {}
podDisruptionBudget: {}
# maxUnavailable: 1
# minAvailable: 1