From 4efed13e0ec41079aedff90dda0bbecd6feb29e5 Mon Sep 17 00:00:00 2001 From: Ales Lerch <13370338+axeII@users.noreply.github.com> Date: Thu, 29 Aug 2024 19:57:40 +0200 Subject: [PATCH 1/2] feat: adds kromgo configurations to the cluster --- .../monitoring/kromgo/app/helmrelease.yaml | 122 ++++++++++++++++++ .../monitoring/kromgo/app/kustomization.yaml | 11 ++ .../kromgo/app/resources/config.yaml | 59 +++++++++ kubernetes/apps/monitoring/kromgo/ks.yaml | 20 +++ kubernetes/apps/monitoring/kustomization.yaml | 1 + 5 files changed, 213 insertions(+) create mode 100644 kubernetes/apps/monitoring/kromgo/app/helmrelease.yaml create mode 100644 kubernetes/apps/monitoring/kromgo/app/kustomization.yaml create mode 100644 kubernetes/apps/monitoring/kromgo/app/resources/config.yaml create mode 100644 kubernetes/apps/monitoring/kromgo/ks.yaml diff --git a/kubernetes/apps/monitoring/kromgo/app/helmrelease.yaml b/kubernetes/apps/monitoring/kromgo/app/helmrelease.yaml new file mode 100644 index 000000000..6f63d6240 --- /dev/null +++ b/kubernetes/apps/monitoring/kromgo/app/helmrelease.yaml @@ -0,0 +1,122 @@ +--- +apiVersion: helm.toolkit.fluxcd.io/v2 +kind: HelmRelease +metadata: + name: &app kromgo +spec: + interval: 30m + chart: + spec: + chart: app-template + version: 3.4.0 + sourceRef: + kind: HelmRepository + name: bjw-s-charts + namespace: flux-system + install: + remediation: + retries: 3 + upgrade: + cleanupOnFail: true + remediation: + strategy: rollback + retries: 3 + values: + controllers: + kromgo: + replicas: 2 + strategy: RollingUpdate + annotations: + reloader.stakater.com/auto: "true" + containers: + app: + image: + repository: ghcr.io/kashalls/kromgo + tag: v0.4.1@sha256:237e6ac3f3bc791343e1ee84122ce9b97abf7eed86cd522d8bf4cba10a041e9f + env: + HEALTH_HOST: 0.0.0.0 + HEALTH_PORT: &healthPort 8888 + PROMETHEUS_URL: http://thanos-query-frontend.monitoring.svc.cluster.local:10902 + SERVER_HOST: 0.0.0.0 + SERVER_PORT: &port 8080 + probes: + liveness: &probes + enabled: true + custom: true + spec: + httpGet: + path: /-/ready + port: *healthPort + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + readiness: *probes + resources: + requests: + cpu: 10m + limits: + memory: 64Mi + securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true + capabilities: + drop: + - ALL + defaultPodOptions: + dnsConfig: + options: + - name: ndots + value: "1" + securityContext: + runAsNonRoot: true + runAsUser: 1000 + runAsGroup: 1000 + topologySpreadConstraints: + - maxSkew: 1 + topologyKey: kubernetes.io/hostname + whenUnsatisfiable: DoNotSchedule + labelSelector: + matchLabels: + app.kubernetes.io/name: *app + ingress: + app: + className: external + annotations: + gatus.io/status-code: "404" + hajimari.io/enable: "false" + hosts: + - host: &host "{{ .Release.Name }}.${SECRET_DOMAIN}" + paths: + - path: / + service: + identifier: app + port: http + tls: + - hosts: + - *host + persistence: + config: + type: configMap + name: kromgo-configmap + globalMounts: + - path: /kromgo/config.yaml + subPath: config.yaml + readOnly: true + service: + app: + controller: *app + ports: + http: + port: *port + health: + port: *healthPort + serviceMonitor: + app: + serviceName: *app + endpoints: + - port: health + scheme: http + path: /metrics + interval: 1m + scrapeTimeout: 10s diff --git a/kubernetes/apps/monitoring/kromgo/app/kustomization.yaml b/kubernetes/apps/monitoring/kromgo/app/kustomization.yaml new file mode 100644 index 000000000..9c015eb31 --- /dev/null +++ b/kubernetes/apps/monitoring/kromgo/app/kustomization.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ./helmrelease.yaml +configMapGenerator: + - name: kromgo-configmap + files: + - ./resources/config.yaml +generatorOptions: + disableNameSuffixHash: true diff --git a/kubernetes/apps/monitoring/kromgo/app/resources/config.yaml b/kubernetes/apps/monitoring/kromgo/app/resources/config.yaml new file mode 100644 index 000000000..a1e1ba713 --- /dev/null +++ b/kubernetes/apps/monitoring/kromgo/app/resources/config.yaml @@ -0,0 +1,59 @@ +--- +metrics: + - name: cluster_node_count + query: count(count by (node) (kube_node_status_condition{condition="Ready"})) + colors: + - { color: green, min: 0, max: 9999 } + + - name: cluster_pod_count + query: sum(kube_pod_status_phase{phase="Running"}) + colors: + - { color: green, min: 0, max: 9999 } + + - name: cluster_cpu_usage + query: round(avg(cluster:node_cpu:ratio_rate5m) * 100, 0.1) + suffix: "%" + colors: + - { color: green, min: 0, max: 35 } + - { color: orange, min: 36, max: 75 } + - { color: red, min: 76, max: 9999 } + + - name: cluster_memory_usage + query: round(sum(node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes) / sum(node_memory_MemTotal_bytes) * 100, 0.1) + suffix: "%" + colors: + - { color: green, min: 0, max: 35 } + - { color: orange, min: 36, max: 75 } + - { color: red, min: 76, max: 9999 } + + # - name: cluster_power_usage + # query: round(upsHighPrecOutputLoad, 0.1) + # suffix: w + # colors: + # - { color: green, min: 0, max: 400 } + # - { color: orange, min: 401, max: 750 } + # - { color: red, min: 751, max: 9999 } + + - name: cluster_age_days + query: round((time() - min(kube_node_created)) / 86400) + suffix: d + colors: + - { color: green, min: 0, max: 180 } + - { color: orange, min: 181, max: 360 } + - { color: red, min: 361, max: 9999 } + + - name: cluster_uptime_days + query: round(avg(node_time_seconds - node_boot_time_seconds) / 86400) + suffix: d + colors: + - { color: green, min: 0, max: 180 } + - { color: orange, min: 181, max: 360 } + - { color: red, min: 361, max: 9999 } + + - name: kubernetes_version + query: kubernetes_build_info{service="kubernetes"} + label: git_version + + # - name: talos_version + # query: node_os_info{name="Talos"} + # label: version_id diff --git a/kubernetes/apps/monitoring/kromgo/ks.yaml b/kubernetes/apps/monitoring/kromgo/ks.yaml new file mode 100644 index 000000000..353162a7e --- /dev/null +++ b/kubernetes/apps/monitoring/kromgo/ks.yaml @@ -0,0 +1,20 @@ +--- +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: &app kromgo + namespace: flux-system +spec: + targetNamespace: monitoring + commonMetadata: + labels: + app.kubernetes.io/name: *app + path: ./kubernetes/apps/monitoring/kromgo/app + prune: true + sourceRef: + kind: GitRepository + name: home-kubernetes + wait: true + interval: 30m + retryInterval: 1m + timeout: 5m diff --git a/kubernetes/apps/monitoring/kustomization.yaml b/kubernetes/apps/monitoring/kustomization.yaml index 74f6e1e1b..7544da4b7 100644 --- a/kubernetes/apps/monitoring/kustomization.yaml +++ b/kubernetes/apps/monitoring/kustomization.yaml @@ -11,3 +11,4 @@ resources: - ./kubernetes-dashboard/ks.yaml - ./gatus/ks.yaml - ./karma/ks.yaml + - ./kromgo/ks.yaml From 6e7f2bc9e349ea1d4a1771efab10369c9220a976 Mon Sep 17 00:00:00 2001 From: Ales Lerch <13370338+axeII@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:02:12 +0200 Subject: [PATCH 2/2] feat: adds metadata into readme --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index f66502212..8d23c900e 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,18 @@ _... automated via [Flux](https://github.com/fluxcd/flux2), [Renovate](https://g +
+ +[![Age-Days](https://img.shields.io/endpoint?url=https%3A%2F%2Fkromgo.juno.moe%2Fcluster_age_days&style=flat-square&label=Age)](https://github.com/kashalls/kromgo)   +[![Uptime-Days](https://img.shields.io/endpoint?url=https%3A%2F%2Fkromgo.juno.moe%2Fcluster_uptime_days&style=flat-square&label=Uptime)](https://github.com/kashalls/kromgo)   +[![Node-Count](https://img.shields.io/endpoint?url=https%3A%2F%2Fkromgo.juno.moe%2Fcluster_node_count&style=flat-square&label=Nodes)](https://github.com/kashalls/kromgo)   +[![Pod-Count](https://img.shields.io/endpoint?url=https%3A%2F%2Fkromgo.juno.moe%2Fcluster_pod_count&style=flat-square&label=Pods)](https://github.com/kashalls/kromgo)   +[![CPU-Usage](https://img.shields.io/endpoint?url=https%3A%2F%2Fkromgo.juno.moe%2Fcluster_cpu_usage&style=flat-square&label=CPU)](https://github.com/kashalls/kromgo)   +[![Memory-Usage](https://img.shields.io/endpoint?url=https%3A%2F%2Fkromgo.juno.moe%2Fcluster_memory_usage&style=flat-square&label=Memory)](https://github.com/kashalls/kromgo)   +[![Power-Usage](https://img.shields.io/endpoint?url=https%3A%2F%2Fkromgo.juno.moe%2Fcluster_power_usage&style=flat-square&label=Power)](https://github.com/kashalls/kromgo) +
+ +--- ## 📖 Overview