[stable/redis] Move metrics from deployment to sidecar (#15713)

* [stable/redis] Move metrics from deployment to sidecar

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Use bitnami/redis-exporter container

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Change readme

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Update tags

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Restore metrics service

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Fix typo

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Restore metrics service section in README

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Update ci test metrics tag

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>
This commit is contained in:
Javier J. Salmerón-García
2019-07-24 09:46:17 -07:00
committed by Kubernetes Prow Robot
parent 667f741b82
commit a9808e049d
10 changed files with 142 additions and 177 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: redis
version: 8.1.5
version: 9.0.0
appVersion: 5.0.5
description: Open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.
keywords:
+10 -7
View File
@@ -151,21 +151,21 @@ The following table lists the configurable parameters of the Redis chart and the
| `rbac.role.rules` | Rules to create | `[]` |
| `metrics.enabled` | Start a side-car prometheus exporter | `false` |
| `metrics.image.registry` | Redis exporter image registry | `docker.io` |
| `metrics.image.repository` | Redis exporter image name | `oliver006/redis_exporter` |
| `metrics.image.tag` | Redis exporter image tag | `v1.0.3` |
| `metrics.image.repository` | Redis exporter image name | `bitnami/redis-exporter` |
| `metrics.image.tag` | Redis exporter image tag | `{TAG_NAME}` |
| `metrics.image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `metrics.image.pullSecrets` | Specify docker-registry secret names as an array | `nil` |
| `metrics.extraArgs` | Extra arguments for the binary; possible values [here](https://github.com/oliver006/redis_exporter#flags) | {} |
| `metrics.podLabels` | Additional labels for Metrics exporter pod | {} |
| `metrics.podAnnotations` | Additional annotations for Metrics exporter pod | {} |
| `metrics.service.type` | Kubernetes Service type (redis metrics) | `ClusterIP` |
| `metrics.service.annotations` | Annotations for the services to monitor (redis master and redis slave service) | {} |
| `metrics.service.loadBalancerIP` | loadBalancerIP if redis metrics service type is `LoadBalancer` | `nil` |
| `metrics.resources` | Exporter resource requests/limit | Memory: `256Mi`, CPU: `100m` |
| `metrics.serviceMonitor.enabled` | if `true`, creates a Prometheus Operator ServiceMonitor (also requires `metrics.enabled` to be `true`) | `false` |
| `metrics.serviceMonitor.namespace` | Optional namespace which Prometheus is running in | `nil` |
| `metrics.serviceMonitor.interval` | How frequently to scrape metrics (use by default, falling back to Prometheus' default) | `nil` |
| `metrics.serviceMonitor.selector` | Default to kube-prometheus install (CoreOS recommended), but should be set according to Prometheus install | `{ prometheus: kube-prometheus }` |
| `metrics.service.type` | Kubernetes Service type (redis metrics) | `ClusterIP` |
| `metrics.service.annotations` | Annotations for the services to monitor (redis master and redis slave service) | {} |
| `metrics.service.loadBalancerIP` | loadBalancerIP if redis metrics service type is `LoadBalancer` | `nil` |
| `metrics.priorityClassName` | Metrics exporter pod priorityClassName | {} |
| `persistence.existingClaim` | Provide an existing PersistentVolumeClaim | `nil` |
| `master.persistence.enabled` | Use a PVC to persist data (master node) | `true` |
@@ -365,8 +365,8 @@ By default, the chart mounts a [Persistent Volume](http://kubernetes.io/docs/use
### Existing PersistentVolumeClaim
1. Create the PersistentVolume
1. Create the PersistentVolumeClaim
1. Install the chart
2. Create the PersistentVolumeClaim
3. Install the chart
```bash
$ helm install --set persistence.existingClaim=PVC_NAME stable/redis
@@ -419,6 +419,9 @@ In case the current master crashes, the Sentinel containers will elect a new mas
## Notable changes
### 9.0.0
The metrics exporter has been changed from a separate deployment to a sidecar container, due to the latest changes in the Redis exporter code. Check the [official page](https://github.com/oliver006/redis_exporter/) for more information. The metrics container image was changed from oliver006/redis_exporter to bitnami/redis-exporter (Bitnami's maintained package of oliver006/redis_exporter).
### 7.0.0
In order to improve the performance in case of slave failure, we added persistence to the read-only slaves. That means that we moved from Deployment to StatefulSets. This should not affect upgrades from previous versions of the chart, as the deployments did not contain any persistence at all.
+12 -19
View File
@@ -420,8 +420,8 @@ metrics:
image:
registry: docker.io
repository: oliver006/redis_exporter
tag: v1.0.3
repository: bitnami/redis-exporter
tag: 1.0.3-debian-9-r0
pullPolicy: IfNotPresent
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
@@ -430,31 +430,28 @@ metrics:
# pullSecrets:
# - myRegistryKeySecretName
## Metrics exporter resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
##
# resources: {}
## Metrics exporter pod priorityClassName
# priorityClassName: {}
service:
type: ClusterIP
## Use serviceLoadBalancerIP to request a specific static IP,
## otherwise leave blank
# loadBalancerIP:
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9121"
## Metrics exporter resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
##
# resources: {}
annotations: {}
## Extra arguments for Metrics exporter, for example:
## extraArgs:
## check-keys: myKey,myOtherKey
# extraArgs: {}
## Metrics exporter labels and tolerations for pod assignment
# nodeSelector: {"beta.kubernetes.io/arch": "amd64"}
# tolerations: []
## Metrics exporter pod Annotation and Labels
# podAnnotations: {}
podAnnotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9121"
# podLabels: {}
# Enable this if you're using https://github.com/coreos/prometheus-operator
@@ -469,10 +466,6 @@ metrics:
## [Kube Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#exporters)
selector:
prometheus: kube-prometheus
## Metrics exporter pod priorityClassName
# priorityClassName: {}
##
## Init containers parameters:
## volumePermissions: Change the owner of the persist volume mountpoint to RunAsUser:fsGroup
+13 -19
View File
@@ -420,8 +420,8 @@ metrics:
image:
registry: docker.io
repository: oliver006/redis_exporter
tag: v1.0.3
repository: bitnami/redis-exporter
tag: 1.0.3-debian-9-r0
pullPolicy: IfNotPresent
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
@@ -430,15 +430,6 @@ metrics:
# pullSecrets:
# - myRegistryKeySecretName
service:
type: ClusterIP
## Use serviceLoadBalancerIP to request a specific static IP,
## otherwise leave blank
# loadBalancerIP:
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9121"
## Metrics exporter resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
##
@@ -448,13 +439,19 @@ metrics:
## extraArgs:
## check-keys: myKey,myOtherKey
# extraArgs: {}
## Metrics exporter labels and tolerations for pod assignment
# nodeSelector: {"beta.kubernetes.io/arch": "amd64"}
# tolerations: []
## Metrics exporter pod priorityClassName
# priorityClassName: {}
service:
type: ClusterIP
## Use serviceLoadBalancerIP to request a specific static IP,
## otherwise leave blank
# loadBalancerIP:
annotations: {}
## Metrics exporter pod Annotation and Labels
# podAnnotations: {}
podAnnotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9121"
# podLabels: {}
# Enable this if you're using https://github.com/coreos/prometheus-operator
@@ -470,9 +467,6 @@ metrics:
selector:
prometheus: kube-prometheus
## Metrics exporter pod priorityClassName
# priorityClassName: {}
##
## Init containers parameters:
## volumePermissions: Change the owner of the persist volume mountpoint to RunAsUser:fsGroup
@@ -1,93 +0,0 @@
{{- if .Values.metrics.enabled }}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "redis.fullname" . }}-metrics
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
selector:
matchLabels:
release: "{{ .Release.Name }}"
role: metrics
app: {{ template "redis.name" . }}
template:
metadata:
labels:
release: "{{ .Release.Name }}"
chart: {{ template "redis.chart" . }}
role: metrics
app: {{ template "redis.name" . }}
{{- if .Values.metrics.podLabels }}
{{ toYaml .Values.metrics.podLabels | indent 8 }}
{{- end }}
annotations:
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- if .Values.metrics.podAnnotations }}
{{ toYaml .Values.metrics.podAnnotations | indent 8 }}
{{- end }}
spec:
{{- include "redis.imagePullSecrets" . | indent 6 }}
{{- if .Values.metrics.nodeSelector }}
nodeSelector:
{{ toYaml .Values.metrics.nodeSelector | indent 8 }}
{{- end }}
serviceAccountName: "{{ template "redis.serviceAccountName" . }}"
{{- if .Values.metrics.priorityClassName }}
priorityClassName: "{{ .Values.metrics.priorityClassName }}"
{{- end }}
{{- if .Values.metrics.tolerations }}
tolerations:
{{ toYaml .Values.metrics.tolerations | indent 8 }}
{{- end }}
containers:
- name: metrics
image: {{ template "redis.metrics.image" . }}
imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
args:
{{- range $key, $value := .Values.metrics.extraArgs }}
- --{{ $key }}={{ $value }}
{{- end }}
env:
- name: REDIS_ADDR
{{- if and .Values.cluster.enabled .Values.sentinel.enabled }}
value: {{ printf "%s:%d" ( include "redis.fullname" . ) ( int .Values.sentinel.service.redisPort ) | quote }}
{{- else if .Values.cluster.enabled }}
value: {{ printf "%s-master:%d,%s-slave:%d" ( include "redis.fullname" . ) ( int .Values.redisPort ) ( include "redis.fullname" . ) ( int .Values.redisPort ) | quote }}
{{- else }}
value: {{ printf "%s-master:%d" ( include "redis.fullname" . ) (int .Values.redisPort) | quote }}
{{- end }}
- name: REDIS_ALIAS
value: {{ template "redis.fullname" . }}
{{- if .Values.usePassword }}
{{- if .Values.usePasswordFile }}
- name: REDIS_PASSWORD_FILE
value: "/secrets/redis-password"
{{- else }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "redis.secretName" . }}
key: redis-password
{{- end }}
{{- end }}
volumeMounts:
{{- if .Values.usePasswordFile }}
- name: redis-password
mountPath: /secrets/
{{- end }}
ports:
- name: metrics
containerPort: 9121
resources:
{{ toYaml .Values.metrics.resources | indent 10 }}
volumes:
{{- if .Values.usePasswordFile }}
- name: redis-password
secret:
secretName: {{ template "redis.secretName" . }}
{{- end }}
{{- end }}
+1 -2
View File
@@ -25,5 +25,4 @@ spec:
selector:
app: {{ template "redis.name" . }}
release: {{ .Release.Name }}
role: metrics
{{- end }}
{{- end }}
@@ -24,6 +24,10 @@ spec:
{{- if .Values.master.podLabels }}
{{ toYaml .Values.master.podLabels | indent 8 }}
{{- end }}
{{- if .Values.metrics.podLabels }}
{{ toYaml .Values.metrics.podLabels | indent 8 }}
{{- end }}
annotations:
checksum/health: {{ include (print $.Template.BasePath "/health-configmap.yaml") . | sha256sum }}
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
@@ -31,6 +35,9 @@ spec:
{{- if .Values.master.podAnnotations }}
{{ toYaml .Values.master.podAnnotations | indent 8 }}
{{- end }}
{{- if .Values.metrics.podAnnotations }}
{{ toYaml .Values.metrics.podAnnotations | indent 8 }}
{{- end }}
spec:
{{- include "redis.imagePullSecrets" . | indent 6 }}
{{- if .Values.securityContext.enabled }}
@@ -258,6 +265,40 @@ spec:
- name: sentinel-tmp-conf
mountPath: /opt/bitnami/redis-sentinel/etc/
{{- end }}
{{- if .Values.metrics.enabled }}
- name: metrics
image: {{ template "redis.metrics.image" . }}
imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
args:
{{- range $key, $value := .Values.metrics.extraArgs }}
- --{{ $key }}={{ $value }}
{{- end }}
env:
- name: REDIS_ALIAS
value: {{ template "redis.fullname" . }}
{{- if .Values.usePassword }}
{{- if .Values.usePasswordFile }}
- name: REDIS_PASSWORD_FILE
value: "/secrets/redis-password"
{{- else }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "redis.secretName" . }}
key: redis-password
{{- end }}
{{- end }}
volumeMounts:
{{- if .Values.usePasswordFile }}
- name: redis-password
mountPath: /secrets/
{{- end }}
ports:
- name: metrics
containerPort: 9121
resources:
{{ toYaml .Values.metrics.resources | indent 10 }}
{{- end }}
{{- $needsVolumePermissions := and .Values.volumePermissions.enabled (and ( and .Values.master.persistence.enabled (not .Values.persistence.existingClaim) ) .Values.securityContext.enabled) }}
{{- if or $needsVolumePermissions .Values.sysctlImage.enabled }}
initContainers:
@@ -31,6 +31,9 @@ spec:
app: {{ template "redis.name" . }}
{{- if .Values.slave.podLabels }}
{{ toYaml .Values.slave.podLabels | indent 8 }}
{{- end }}
{{- if .Values.metrics.podLabels }}
{{ toYaml .Values.metrics.podLabels | indent 8 }}
{{- end }}
annotations:
checksum/health: {{ include (print $.Template.BasePath "/health-configmap.yaml") . | sha256sum }}
@@ -39,6 +42,9 @@ spec:
{{- if .Values.slave.podAnnotations }}
{{ toYaml .Values.slave.podAnnotations | indent 8 }}
{{- end }}
{{- if .Values.metrics.podAnnotations }}
{{ toYaml .Values.metrics.podAnnotations | indent 8 }}
{{- end }}
spec:
{{- include "redis.imagePullSecrets" . | indent 6 }}
{{- if .Values.securityContext.enabled }}
@@ -286,6 +292,40 @@ spec:
- name: sentinel-tmp-conf
mountPath: /opt/bitnami/redis-sentinel/etc
{{- end }}
{{- if .Values.metrics.enabled }}
- name: metrics
image: {{ template "redis.metrics.image" . }}
imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
args:
{{- range $key, $value := .Values.metrics.extraArgs }}
- --{{ $key }}={{ $value }}
{{- end }}
env:
- name: REDIS_ALIAS
value: {{ template "redis.fullname" . }}
{{- if .Values.usePassword }}
{{- if .Values.usePasswordFile }}
- name: REDIS_PASSWORD_FILE
value: "/secrets/redis-password"
{{- else }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "redis.secretName" . }}
key: redis-password
{{- end }}
{{- end }}
volumeMounts:
{{- if .Values.usePasswordFile }}
- name: redis-password
mountPath: /secrets/
{{- end }}
ports:
- name: metrics
containerPort: 9121
resources:
{{ toYaml .Values.metrics.resources | indent 10 }}
{{- end }}
{{- $needsVolumePermissions := and .Values.volumePermissions.enabled (and .Values.slave.persistence.enabled .Values.securityContext.enabled) }}
{{- if or $needsVolumePermissions .Values.sysctlImage.enabled }}
initContainers:
+13 -19
View File
@@ -441,8 +441,8 @@ metrics:
image:
registry: docker.io
repository: oliver006/redis_exporter
tag: v1.0.3
repository: bitnami/redis-exporter
tag: 1.0.3-debian-9-r0
pullPolicy: IfNotPresent
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
@@ -451,15 +451,6 @@ metrics:
# pullSecrets:
# - myRegistryKeySecretName
service:
type: ClusterIP
## Use serviceLoadBalancerIP to request a specific static IP,
## otherwise leave blank
# loadBalancerIP:
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9121"
## Metrics exporter resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
##
@@ -470,12 +461,18 @@ metrics:
## check-keys: myKey,myOtherKey
# extraArgs: {}
## Metrics exporter labels and tolerations for pod assignment
# nodeSelector: {"beta.kubernetes.io/arch": "amd64"}
# tolerations: []
## Metrics exporter pod priorityClassName
# priorityClassName: {}
service:
type: ClusterIP
## Use serviceLoadBalancerIP to request a specific static IP,
## otherwise leave blank
# loadBalancerIP:
annotations: {}
## Metrics exporter pod Annotation and Labels
# podAnnotations: {}
podAnnotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9121"
# podLabels: {}
# Enable this if you're using https://github.com/coreos/prometheus-operator
@@ -491,9 +488,6 @@ metrics:
selector:
prometheus: kube-prometheus
## Metrics exporter pod priorityClassName
# priorityClassName: {}
##
## Init containers parameters:
## volumePermissions: Change the owner of the persist volume mountpoint to RunAsUser:fsGroup
+11 -17
View File
@@ -441,8 +441,8 @@ metrics:
image:
registry: docker.io
repository: oliver006/redis_exporter
tag: v1.0.3
repository: bitnami/redis-exporter
tag: 1.0.3-debian-9-r0
pullPolicy: IfNotPresent
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
@@ -450,16 +450,6 @@ metrics:
##
# pullSecrets:
# - myRegistryKeySecretName
service:
type: ClusterIP
## Use serviceLoadBalancerIP to request a specific static IP,
## otherwise leave blank
# loadBalancerIP:
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9121"
## Metrics exporter resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
##
@@ -470,12 +460,10 @@ metrics:
## check-keys: myKey,myOtherKey
# extraArgs: {}
## Metrics exporter labels and tolerations for pod assignment
# nodeSelector: {"beta.kubernetes.io/arch": "amd64"}
# tolerations: []
## Metrics exporter pod Annotation and Labels
# podAnnotations: {}
podAnnotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9121"
# podLabels: {}
# Enable this if you're using https://github.com/coreos/prometheus-operator
@@ -493,6 +481,12 @@ metrics:
## Metrics exporter pod priorityClassName
# priorityClassName: {}
service:
type: ClusterIP
## Use serviceLoadBalancerIP to request a specific static IP,
## otherwise leave blank
# loadBalancerIP:
annotations: {}
##
## Init containers parameters: