fix(metrics): collect metrics from kube components

This commit is contained in:
Peter 2022-12-30 13:34:00 +01:00
parent 134872ad83
commit d0fb6d856c
Signed by: prskr
GPG key ID: C1DB5D2E8DB512F9
4 changed files with 80 additions and 0 deletions

View file

@ -31,3 +31,11 @@ rules:
- "ingresses" - "ingresses"
verbs: verbs:
- "*" - "*"
- apiGroups:
- "monitoring.coreos.com"
resources:
- "podmonitors"
- "servicemonitors"
verbs:
- "*"

View file

@ -16,6 +16,14 @@
group: root group: root
mode: 0644 mode: 0644
- name: Render control plain config
ansible.builtin.template:
src: cp-config.yaml.j2
dest: /etc/rancher/k3s/config.yaml
owner: root
group: root
mode: 0644
- name: Enable and check K3s service - name: Enable and check K3s service
systemd: systemd:
name: k3s name: k3s

View file

@ -0,0 +1,10 @@
kube-controller-manager-arg:
- "bind-address=0.0.0.0"
- "authorization-always-allow-paths=/healthz,/readyz,/livez,/metrics"
kube-proxy-arg:
- "metrics-bind-address=0.0.0.0:10249"
kube-scheduler-arg:
- "bind-address=0.0.0.0"
- "authorization-always-allow-paths=/healthz,/readyz,/livez,/metrics"
# Controller Manager exposes etcd sqllite metrics
etcd-expose-metrics: true

View file

@ -19,6 +19,18 @@ prometheus:
serviceMonitorSelector: serviceMonitorSelector:
matchLabels: matchLabels:
prometheus: default prometheus: default
ruleSelector:
matchLabels:
prometheus: default
ruleNamespaceSelector:
matchLabels:
prometheus: default
podMonitorSelector:
matchLabels:
prometheus: default
podMonitorNamespaceSelector:
matchLabels:
prometheus: default
storageSpec: storageSpec:
volumeClaimTemplate: volumeClaimTemplate:
spec: spec:
@ -33,6 +45,36 @@ alertmanager:
kubeEtcd: kubeEtcd:
enabled: false enabled: false
kubeControllerManager:
enabled: true
endpoints: ['{{ master_ip }}']
service:
enabled: true
port: 10257
targetPort: 10257
serviceMonitor:
enabled: true
https: true
kubeScheduler:
enabled: true
endpoints: ['{{ master_ip }}']
service:
enabled: true
port: 10259
targetPort: 10259
serviceMonitor:
enabled: true
https: true
kubeProxy:
enabled: true
endpoints: ['{{ master_ip }}']
service:
enabled: true
port: 10249
targetPort: 10249
grafana: grafana:
ingress: ingress:
enabled: true enabled: true
@ -64,3 +106,15 @@ grafana:
persistence: persistence:
enabled: false enabled: false
storageClassName: hcloud-volumes storageClassName: hcloud-volumes
prometheus-node-exporter:
prometheus:
monitor:
additionalLabels:
prometheus: default
kube-state-metrics:
prometheus:
monitor:
additionalLabels:
prometheus: default