enable prometheus servicemonitor (#164)

also enable proper healthchecks

Fixes #160
Fixes #161

Signed-off-by: Jeff Billimek <jeff@billimek.com>
This commit is contained in:
Jeff Billimek 2020-03-08 20:10:57 -04:00 committed by GitHub
parent 018c383c7c
commit a2f4de737f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 65 additions and 41 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "v0.5"
description: DNS proxy as ad-blocker for local network
name: blocky
version: 1.1.2
version: 2.0.0
keywords:
- blocky
- dbs

View File

@ -19,6 +19,10 @@ spec:
labels:
app.kubernetes.io/name: {{ include "blocky.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- with .Values.podAnnotations }}
annotations:
{{ toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: {{ .Chart.Name }}
@ -36,34 +40,34 @@ spec:
- name: logs
mountPath: /logs
ports:
- name: prometheus
ports:
- name: monitoring
containerPort: 4000
- name: dns
containerPort: 53
protocol: TCP
- containerPort: 53
name: dns
protocol: TCP
- containerPort: 53
name: dns-udp
- name: dns-udp
containerPort: 53
protocol: UDP
# livenessProbe:
# httpGet:
# path: /
# port: http
# failureThreshold: {{ .Values.probes.liveness.failureThreshold }}
# periodSeconds: {{ .Values.probes.liveness.periodSeconds }}
# readinessProbe:
# httpGet:
# path: /
# port: http
# failureThreshold: {{ .Values.probes.readiness.failureThreshold }}
# periodSeconds: {{ .Values.probes.readiness.periodSeconds }}
# startupProbe:
# httpGet:
# path: /
# port: http
# initialDelaySeconds: {{ .Values.probes.startup.initialDelaySeconds }}
# failureThreshold: {{ .Values.probes.startup.failureThreshold }}
# periodSeconds: {{ .Values.probes.startup.periodSeconds }}
livenessProbe:
httpGet:
path: /metrics
port: monitoring
failureThreshold: {{ .Values.probes.liveness.failureThreshold }}
periodSeconds: {{ .Values.probes.liveness.periodSeconds }}
readinessProbe:
httpGet:
path: /metrics
port: monitoring
failureThreshold: {{ .Values.probes.readiness.failureThreshold }}
periodSeconds: {{ .Values.probes.readiness.periodSeconds }}
startupProbe:
httpGet:
path: /metrics
port: monitoring
initialDelaySeconds: {{ .Values.probes.startup.initialDelaySeconds }}
failureThreshold: {{ .Values.probes.startup.failureThreshold }}
periodSeconds: {{ .Values.probes.startup.periodSeconds }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:

View File

@ -1,21 +1,18 @@
{{- if .Values.servicePrometheus.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "blocky.fullname" . }}-prometheus
name: {{ include "blocky.fullname" . }}-headless
labels:
app.kubernetes.io/name: {{ include "blocky.name" . }}
helm.sh/chart: {{ include "blocky.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
type: {{ .Values.servicePrometheus.type }}
clusterIP: None
ports:
- port: {{ .Values.servicePrometheus.port }}
targetPort: prometheus
protocol: TCP
name: prometheus
- name: monitoring
port: 4000
targetPort: monitoring
selector:
app.kubernetes.io/name: {{ include "blocky.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

View File

@ -0,0 +1,23 @@
{{- if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "blocky.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "blocky.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "blocky.chart" . }}
{{- with .Values.serviceMonitor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
app.kubernetes.io/name: {{ include "blocky.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
endpoints:
- port: monitoring
interval: 30s
path: /metrics
{{- end }}

View File

@ -152,14 +152,14 @@ serviceUDP:
# metallb.universe.tf/address-pool: network-services
# metallb.universe.tf/allow-shared-ip: blocky-svc
servicePrometheus:
serviceMonitor:
enabled: false
port: 4000
type: ClusterIP
externalTrafficPolicy: Local
loadBalancerIP: ""
# a fixed LoadBalancer IP
annotations: {}
additionalLabels: {}
## Pod Annotations
podAnnotations:
prometheus.io/scrape: "true"
prometheus.io/port: "monitoring"
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious