Skip to content

Commit

Permalink
Merge pull request #1338 from axeII/feat/kromgo
Browse files Browse the repository at this point in the history
feat: adds kromgo configurations to the cluster
  • Loading branch information
axeII authored Aug 29, 2024
2 parents 74dbb30 + 6e7f2bc commit 6aaeda7
Show file tree
Hide file tree
Showing 6 changed files with 225 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ _... automated via [Flux](https://github.com/fluxcd/flux2), [Renovate](https://g

</div>

<div align="center">

[![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)&nbsp;&nbsp;
[![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)&nbsp;&nbsp;
[![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)&nbsp;&nbsp;
[![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)&nbsp;&nbsp;
[![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)&nbsp;&nbsp;
[![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)&nbsp;&nbsp;
[![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)
</div>

---

## 📖 Overview

Expand Down
122 changes: 122 additions & 0 deletions kubernetes/apps/monitoring/kromgo/app/helmrelease.yaml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions kubernetes/apps/monitoring/kromgo/app/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -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
59 changes: 59 additions & 0 deletions kubernetes/apps/monitoring/kromgo/app/resources/config.yaml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions kubernetes/apps/monitoring/kromgo/ks.yaml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions kubernetes/apps/monitoring/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ resources:
- ./kubernetes-dashboard/ks.yaml
- ./gatus/ks.yaml
- ./karma/ks.yaml
- ./kromgo/ks.yaml

0 comments on commit 6aaeda7

Please sign in to comment.