Skip to content

Commit

Permalink
add more components to monitoring stack
Browse files Browse the repository at this point in the history
  • Loading branch information
soerenschneider committed Sep 17, 2024
1 parent c4306d2 commit 93c333b
Show file tree
Hide file tree
Showing 10 changed files with 277 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
modules:
dns_soerenschneider:
dns:
query_name: router.ez.soeren.cloud
query_type: A
validate_answer_rrs:
fail_if_not_matches_regexp:
- "router.ez.soeren.cloud.\t.*\tIN\tA\t.*192\\.168\\.2\\.3"
prober: dns
http:
http:
tls_config:
cert_file: /certs/tls.crt
key_file: /certs/tls.key
valid_status_codes:
- 200
- 204
- 301
- 302
- 403
- 404
prober: http
timeout: 5s
http_2xx:
prober: http
timeout: 5s
icmp:
icmp:
preferred_ip_protocol: ip4
prober: icmp
timeout: 2s
tcp_cert:
prober: tcp
tcp:
tls: true
timeout: 2s
tcp_connect:
prober: tcp
timeout: 2s
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: monitoring
resources:
- ../../../../apps/monitoring/blackbox_exporter
components:
- ../../../../apps/monitoring/blackbox_exporter/components/custom-config
- ../../../../apps/monitoring/blackbox_exporter/components/reverse-proxy
- ../../../../apps/monitoring/blackbox_exporter/components/tls-client-cert
configMapGenerator:
- name: blackbox-exporter-config
files:
- config.yaml
67 changes: 67 additions & 0 deletions clusters/svc.pt.soeren.cloud/monitoring/karma/karma.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
alertmanager:
interval: 60s
servers:
- name: local
uri: http://alertmanager
timeout: 10s
proxy: true
readonly: false
headers:
X-Auth-Test: some-token-or-other-string
annotations:
default:
hidden: false
hidden:
- help
visible: []
custom:
css: /custom.css
js: /custom.js
debug: false
filters:
default:
- "@receiver=by-cluster-service"
karma:
name: karma-prod
labels:
color:
static:
- job
unique:
- cluster
- instance
- "@receiver"
keep: []
strip: []
listen:
address: "0.0.0.0"
port: 8000
cors:
allowedOrigins:
- https://example.com
log:
config: false
level: info
silences:
comments:
linkDetect:
rules:
- regex: "(DEVOPS-[0-9]+)"
uriTemplate: https://jira.example.com/browse/$1
receivers:
keep: []
strip: []
silenceForm:
strip:
labels:
- job
defaultAlertmanagers:
- local
ui:
refresh: 30s
hideFiltersWhenIdle: true
colorTitlebar: false
minimalGroupWidth: 420
alertsPerGroup: 5
collapseGroups: collapsedOnMobile
20 changes: 20 additions & 0 deletions clusters/svc.pt.soeren.cloud/monitoring/karma/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: monitoring
resources:
- ../../../../apps/monitoring/karma
components:
- ../../../../apps/monitoring/karma/components/reverse-proxy
patches:
- target:
kind: Deployment
name: karma
patch: |-
- op: add
path: /spec/template/spec/priorityClassName
value: prod-low-prio
configMapGenerator:
- name: karma-config
files:
- karma.yaml
60 changes: 60 additions & 0 deletions clusters/svc.pt.soeren.cloud/monitoring/karma/networkpolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: karma
spec:
podSelector:
matchLabels:
app: karma
policyTypes:
- Egress
- Ingress
ingress:
- ports:
- protocol: TCP
port: karma
from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: istio-system
podSelector:
matchLabels:
istio: ingressgateway
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: monitoring
podSelector:
matchLabels:
app: prometheus
egress:
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: monitoring
podSelector:
matchLabels:
app: prometheus
- to:
- ipBlock:
cidr: 10.0.0.0/8
ports:
- protocol: TCP
port: 80
- protocol: TCP
port: 443
- protocol: TCP
port: 9093
- to:
- ipBlock:
cidr: 192.168.0.0/16
ports:
- protocol: TCP
port: 9093
- protocol: TCP
port: 443
- to:
- ipBlock:
cidr: 0.0.0.0/0
except:
- 192.168.0.0/16
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: monitoring
resources:
- ../../../../apps/monitoring/kube-state-metrics
components:
- ../../../../apps/monitoring/kube-state-metrics/components/rbac
33 changes: 33 additions & 0 deletions clusters/svc.pt.soeren.cloud/monitoring/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: monitoring
resources:
- namespace.yaml
- alertmanager
- blackbox-exporter
- karma
- kube-state-metrics
- prometheus
- pushgateway
- vmalert
components:
- ../../../apps/monitoring/components/tls-client-cert
- ../../../apps/monitoring/components/reverse-proxy
- ../../../apps/monitoring/components/reverse-proxy-istio
patches:
- target:
kind: VirtualService
name: monitoring-reverse-proxy
patch: |-
- op: "replace"
path: "/spec/hosts"
value:
- "monitoring.svc.pt.soeren.cloud"
- target:
kind: Issuer
name: vault-issuer
patch: |-
- op: "replace"
path: "/spec/vault/auth/kubernetes/mountPath"
value: "/v1/auth/svc.pt.soeren.cloud"
7 changes: 7 additions & 0 deletions clusters/svc.pt.soeren.cloud/monitoring/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
kind: Namespace
apiVersion: v1
metadata:
name: monitoring
labels:
name: monitoring
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: monitoring
resources:
- ../../../../apps/monitoring/pushgateway
components:
- ../../../../apps/monitoring/pushgateway/components/reverse-proxy
20 changes: 20 additions & 0 deletions clusters/svc.pt.soeren.cloud/monitoring/vmalert/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: monitoring
resources:
- ../../../../apps/monitoring/vmalert
components:
- ../../../../apps/monitoring/vmalert/components/tls-client-cert
- ../../../../apps/monitoring/vmalert/components/initcontainer-seed-rules
patches:
- target:
kind: Deployment
name: vmalert
patch: |
- op: add
path: "/spec/template/spec/containers/0/args"
value:
- "-notifier.url=http://alertmanager"
- "-datasource.url=http://prometheus"
- "-rule=/rules/*.rules"

0 comments on commit 93c333b

Please sign in to comment.