feat(metrics): Calico service and monitor added

!1
This commit is contained in:
2023-09-19 23:18:27 +09:30
parent 9e3f33ae56
commit 63c0381bd1
3 changed files with 62 additions and 0 deletions

View File

@ -37,6 +37,12 @@ This helm chart started off with components from multiple open-source projects.
- Grafana as the visualization frontend
- Service monitors
- Calico, _if Selected_
> enable calico metrics with `kubectl patch felixconfiguration default --type merge --patch '{"spec":{"prometheusMetricsEnabled": true}}'`
## Installation

View File

@ -0,0 +1,20 @@
---
{{- if eq .Values.nfc_monitoring.kubernetes.networking "calico" -}}
apiVersion: v1
kind: Service
metadata:
name: calico-metrics
namespace: kube-system
labels:
k8s-app: calico-node
spec:
clusterIP: None
selector:
k8s-app: calico-node
ports:
- port: 9091
name: metrics
targetPort: 9091
{{- end -}}

View File

@ -0,0 +1,36 @@
---
{{- if eq .Values.nfc_monitoring.kubernetes.networking "calico" -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app.kubernetes.io/name: calico
app.kubernetes.io/component: networking
app.kubernetes.io/part-of: {{ $.Chart.Name }}
app.kubernetes.io/version: {{ $.Chart.Version }}
app.kubernetes.io/managed-by: {{ $.Release.Service }}
k8s-app: calico-node
name: calico
namespace: kube-system
spec:
endpoints:
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
interval: 15s
port: metrics
relabelings:
- action: replace
regex: (.*)
replacement: $1
sourceLabels:
- __meta_kubernetes_pod_node_name
targetLabel: instance
scheme: http
# tlsConfig:
# insecureSkipVerify: true
jobLabel: app.kubernetes.io/name
selector:
matchLabels:
k8s-app: calico-node
{{- end -}}