This commit is contained in:
2026-04-28 14:58:12 +02:00
parent d3b247196c
commit 098fac1220
14 changed files with 26 additions and 183 deletions

View File

@@ -7,11 +7,11 @@ spec:
project: default
source:
repoURL: https://gitea.vhn-demo.duckdns.org/hoang/devops-infa.git
targetRevision: main
targetRevision: HEAD
path: kafka-demo
destination:
server: https://kubernetes.default.svc
namespace: kafka-demo
namespace: kafka
syncPolicy:
automated:
prune: true

View File

@@ -6,14 +6,15 @@ metadata:
spec:
project: default
source:
repoURL: https://gitea.vhn-demo.duckdns.org/hoang/devops-infa.git
targetRevision: main
repoURL: https://grafana.github.io/helm-charts
chart: loki-stack
targetRevision: 2.9.10
helm:
releaseName: loki-stack
valueFiles:
- ../../monitoring-logging/values.yaml
destination:
server: https://kubernetes.default.svc
namespace: monitoring-logging
namespace: monitoring
syncPolicy:
automated:
prune: true

View File

@@ -6,16 +6,15 @@ metadata:
spec:
project: default
source:
repoURL: https://gitea.vhn-demo.duckdns.org/hoang/devops-infa.git
targetRevision: main
repoURL: https://prometheus-community.github.io/helm-charts
chart: kube-prometheus-stack
targetRevision: 58.2.0
helm:
releaseName: prometheus-stack
valueFiles:
- prometheus/prometheus-values.yml
- ../../prometheus/values.yaml
destination:
server: https://kubernetes.default.svc
namespace: prometheus
namespace: monitoring
syncPolicy:
automated:
prune: true

View File

@@ -2,20 +2,18 @@ apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
name: kafka-demo
namespace: kafka-demo
spec:
kafka:
version: 4.1.1
replicas: 1
listeners:
- name: plain
port: 9092
type: internal
tls: false
- name: external
port: 9094
type: nodeport
tls: false
storage:
type: ephemeral
zookeeper:
replicas: 1
storage:
type: ephemeral
entityOperator:

View File

@@ -1,4 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
name: kafka-demo

View File

@@ -1,10 +0,0 @@
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaTopic
metadata:
name: orders
namespace: kafka-demo
labels:
strimzi.io/cluster: kafka-demo
spec:
partitions: 3
replicas: 1

View File

@@ -1,10 +0,0 @@
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaTopic
metadata:
name: payments
namespace: kafka-demo
labels:
strimzi.io/cluster: kafka-demo
spec:
partitions: 3
replicas: 1

View File

@@ -1,21 +0,0 @@
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaUser
metadata:
name: app-orders
namespace: kafka-demo
labels:
strimzi.io/cluster: kafka-demo
spec:
authentication:
type: scram-sha-512
authorization:
type: simple
acls:
- resource:
type: topic
name: orders
operation: Read
- resource:
type: topic
name: orders
operation: Write

View File

@@ -1,21 +0,0 @@
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaUser
metadata:
name: app-payments
namespace: kafka-demo
labels:
strimzi.io/cluster: kafka-demo
spec:
authentication:
type: scram-sha-512
authorization:
type: simple
acls:
- resource:
type: topic
name: payments
operation: Read
- resource:
type: topic
name: payments
operation: Write

View File

@@ -0,0 +1,5 @@
loki:
enabled: true
promtail:
enabled: true

View File

@@ -1,26 +0,0 @@
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: kafka-alerts
namespace: prometheus
spec:
groups:
- name: kafka.rules
rules:
- alert: KafkaBrokerDown
expr: up{job="kafka"} == 0
for: 1m
labels:
severity: critical
annotations:
summary: "Kafka broker is down"
description: "No Kafka broker responding for more than 1 minute."
- alert: KafkaConsumerLagHigh
expr: kafka_consumer_lag > 1000
for: 5m
labels:
severity: warning
annotations:
summary: "High consumer lag"
description: "Consumer lag exceeds 1000 messages for 5 minutes."

View File

@@ -1,57 +0,0 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: alertmanager-config
namespace: prometheus
data:
alertmanager.yml: |
global:
resolve_timeout: 5m
smtp_smarthost: 'mail.example.com:587'
smtp_from: 'alertmanager@example.com'
smtp_auth_username: 'alertmanager@example.com'
smtp_auth_password: 'DEIN_PASSWORT'
smtp_require_tls: true
route:
receiver: 'default'
group_by: ['alertname', 'severity']
group_wait: 30s
group_interval: 5m
repeat_interval: 3h
routes:
- match:
severity: critical
receiver: 'sms'
- match:
severity: warning
receiver: 'email'
- match:
severity: info
receiver: 'default'
receivers:
- name: 'default'
webhook_configs:
- url: 'https://outlook.office.com/webhook/DEIN_TEAMS_WEBHOOK'
- name: 'email'
email_configs:
- to: 'ops@example.com'
send_resolved: true
- name: 'sms'
webhook_configs:
- url: 'https://api.twilio.com/2010-04-01/Accounts/DEIN_ACCOUNT_SID/Messages.json'
http_config:
basic_auth:
username: 'DEIN_ACCOUNT_SID'
password: 'DEIN_AUTH_TOKEN'
send_resolved: true
inhibit_rules:
- source_match:
severity: critical
target_match:
severity: warning
equal: ['alertname']

View File

@@ -1,17 +0,0 @@
grafana:
enabled: true
adminPassword: "admin"
service:
type: ClusterIP
dashboardsProvider:
enabled: true
alertmanager:
enabled: true
configMapOverrideName: alertmanager-config
prometheus:
prometheusSpec:
retention: 15d
scrapeInterval: 30s
evaluationInterval: 30s

6
prometheus/values.yml Normal file
View File

@@ -0,0 +1,6 @@
defaultRules:
create: true
prometheus:
prometheusSpec:
retention: 12h