metrics: Scrape metrics from Kubernetes API server

Kubernetes exports a *lot* of metrics in Prometheus format.  I am not
sure what all is there, yet, but apparently several thousand time series
were added.

To allow anonymous access to the metrics, I added this RoleBinding:

```yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: prometheus
rules:
- apiGroups:
  - ""
  resources:
  - nodes/metrics
  verbs:
  - get
- nonResourceURLs:
  - /metrics
  verbs:
  - get
```
This commit is contained in:
2023-05-22 21:21:08 -05:00
parent c0bb387b18
commit 347cda74fd
4 changed files with 44 additions and 0 deletions

View File

@@ -0,0 +1 @@
../../../../kube-root-ca.crt

View File

@@ -46,6 +46,22 @@
- config
- scrape-config
- name: ensure additional ca certificates are installed
copy:
src: '{{ item }}'
dest: /etc/victoria-metrics/{{ item | basename }}
mode: u=rw,go=r
owner: root
group: root
with_fileglob:
- ca-certs/{{ inventory_hostname }}/*.crt
- ca-certs/*.crt
notify:
- reload vmagent
tags:
- cert
- scrape-config
- name: ensure vmagent starts at boot
service:
name: vmagent