postgresql: optional prometheus metrics exporter (#260)

* postgresql: optional prometheus metrics exporter

* split metrics.image into image and imageTag

* bump postgresql chart to 0.3.0

* Adding myself as maintainer for the postgresql chart
This commit is contained in:
Fabian Ruff
2016-12-21 11:31:05 -08:00
committed by Adnan Abdulhussein
parent db9c112464
commit 0374372bae
5 changed files with 38 additions and 1 deletions
+2 -1
View File
@@ -1,5 +1,5 @@
name: postgresql
version: 0.2.2
version: 0.3.0
description: Chart for PostgreSQL
keywords:
- postgresql
@@ -12,4 +12,5 @@ sources:
- https://github.com/docker-library/postgres
maintainers:
- name: swordbeta
- name: databus23
engine: gotpl
+8
View File
@@ -56,6 +56,11 @@ The following tables lists the configurable parameters of the PostgresSQL chart
| `persistence.accessMode` | Use volume as ReadOnly or ReadWrite | `ReadWriteOnce` |
| `persistence.size` | Size of data volume | `8Gi` |
| `resources` | CPU/Memory resource requests/limits | Memory: `256Mi`, CPU: `100m` |
| `metrics.enabled` | Start a side-car prometheus exporter | `false` |
| `metrics.image` | Exporter image | `wrouesnel/postgres_exporter` |
| `metrics.imageTag` | Exporter image | `v0.1.1` |
| `metrics.imagePullPolicy` | Exporter image pull policy | `IfNotPresent` |
| `metrics.resources` | Exporter resource requests/limit | Memory: `256Mi`, CPU: `100m` |
The above parameters map to the env variables defined in [postgres](http://github.com/docker-library/postgres). For more information please refer to the [postgres](http://github.com/docker-library/postgres) image documentation.
@@ -82,3 +87,6 @@ $ helm install --name my-release -f values.yaml stable/postgresql
The [postgres](https://github.com/docker-library/postgres) image stores the PostgreSQL data and configurations at the `/var/lib/postgresql/data/pgdata` path of the container.
The chart mounts a [Persistent Volume](http://kubernetes.io/docs/user-guide/persistent-volumes/) volume at this location. The volume is created using dynamic volume provisioning.
## Metrics
The chart optionally can start a metrics exporter for [prometheus](https://prometheus.io). The metrics endpoint (port 9187) is not exposed and it is expected that the metrics are collected from inside the k8s cluster using something similar as the described in the [example Prometheus scrape configuration](https://github.com/prometheus/prometheus/blob/master/documentation/examples/prometheus-kubernetes.yml).
@@ -67,6 +67,19 @@ spec:
volumeMounts:
- name: data
mountPath: /var/lib/postgresql/data/pgdata
{{- if .Values.metrics.enabled }}
- name: metrics
image: "{{ .Values.metrics.image }}:{{ .Values.metrics.imageTag }}"
imagePullPolicy: {{ default "" .Values.metrics.imagePullPolicy | quote }}
env:
- name: DATA_SOURCE_NAME
value: postgresql://postgres@localhost:5432?sslmode=disable
ports:
- name: metrics
containerPort: 9187
resources:
{{ toYaml .Values.metrics.resources | indent 10 }}
{{- end }}
volumes:
- name: data
{{- if .Values.persistence.enabled }}
+5
View File
@@ -7,6 +7,11 @@ metadata:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.metrics.enabled }}
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9187"
{{- end }}
spec:
ports:
- name: postgresql
+10
View File
@@ -28,6 +28,16 @@ persistence:
accessMode: ReadWriteOnce
size: 8Gi
metrics:
enabled: false
image: wrouesnel/postgres_exporter
imageTag: v0.1.1
imagePullPolicy: IfNotPresent
resources:
requests:
memory: 256Mi
cpu: 100m
## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
##