1
0
Fork 0

forward prom metrics to grafana-cloud

This commit is contained in:
Massaki Archambault 2022-05-26 01:02:48 -04:00
parent 930cfe8357
commit 50c584a468
5 changed files with 47 additions and 12 deletions

View File

@ -2,4 +2,15 @@ resources:
- prometheus.yaml - prometheus.yaml
- prometheus-rbac.yaml - prometheus-rbac.yaml
- prometheus-ingress.yaml - prometheus-ingress.yaml
- traefik-podmonitor.yaml - traefik-podmonitor.yaml
secretGenerator:
- name: grafana-cloud-credentials
type: Opaque
behavior: create
literals:
- username=changeme
- password=changeme
configurations:
- kustomizeconfig/namereference.yaml

View File

@ -0,0 +1,7 @@
nameReference:
- kind: Secret
fieldSpecs:
- kind: Prometheus
path: spec/remoteWrite/basicAuth/username/name
- kind: Prometheus
path: spec/remoteWrite/basicAuth/password/name

View File

@ -4,8 +4,8 @@ metadata:
name: prometheus name: prometheus
spec: spec:
serviceAccountName: prometheus serviceAccountName: prometheus
retention: 28d retention: 1d
retentionSize: 9GB retentionSize: 5GB
ruleSelector: ruleSelector:
matchLabels: matchLabels:
monitor: prometheus monitor: prometheus
@ -18,6 +18,15 @@ spec:
probeSelector: probeSelector:
matchLabels: matchLabels:
monitor: prometheus monitor: prometheus
remoteWrite:
- url: changeme
basicAuth:
username:
name: grafana-cloud-credentials
key: username
password:
name: grafana-cloud-credentials
key: password
securityContext: securityContext:
runAsGroup: 65534 runAsGroup: 65534
runAsNonRoot: true runAsNonRoot: true
@ -26,14 +35,7 @@ spec:
resources: resources:
requests: requests:
cpu: 500m cpu: 500m
memory: 1Gi memory: 500Mi
limits: limits:
cpu: 1000m cpu: 1000m
memory: 2Gi memory: 500Mi
storage:
volumeClaimTemplate:
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 10Gi

View File

@ -62,6 +62,13 @@ secretGenerator:
behavior: replace behavior: replace
literals: literals:
- password=${ssm:/k3s/prod/nextcloud/redis/password} - password=${ssm:/k3s/prod/nextcloud/redis/password}
- name: grafana-cloud-credentials
type: Opaque
namespace: monitoring
behavior: replace
literals:
- username=${ssm:/k3s/prod/monitoring/grafana-cloud/username}
- password=${ssm:/k3s/prod/monitoring/grafana-cloud/password}
# allow "kubectl apply -l managed-by=kustomize --prune ..." # allow "kubectl apply -l managed-by=kustomize --prune ..."
commonLabels: commonLabels:
@ -77,6 +84,11 @@ patchesJson6902:
kind: Deployment kind: Deployment
name: nextcloud name: nextcloud
path: patches/nextcloud-deployment-patch.yaml path: patches/nextcloud-deployment-patch.yaml
- target:
version: v1
kind: Prometheus
name: prometheus
path: patches/prometheus-patch.yaml
# patchesStrategicMerge: # patchesStrategicMerge:
# - patches/blackbox-exporter-probe-patch.yaml # - patches/blackbox-exporter-probe-patch.yaml

View File

@ -0,0 +1,3 @@
- op: replace
path: /spec/remoteWrite/0/url
value: https://prometheus-prod-10-prod-us-central-0.grafana.net/api/prom/push