Skip to content

Commit

Permalink
Merge pull request #1 from fluxcd/monitoring-config
Browse files Browse the repository at this point in the history
Add kube-prometheus-stack, loki-stack & monitoring-config
  • Loading branch information
stefanprodan authored Aug 18, 2023
2 parents c201da1 + ea9580f commit acd76e1
Show file tree
Hide file tree
Showing 12 changed files with 3,529 additions and 0 deletions.
7 changes: 7 additions & 0 deletions kube-prometheus-stack/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: monitoring
resources:
- namespace.yaml
- repository.yaml
- release.yaml
6 changes: 6 additions & 0 deletions kube-prometheus-stack/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
name: monitoring
labels:
app.kubernetes.io/component: monitoring
162 changes: 162 additions & 0 deletions kube-prometheus-stack/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: kube-prometheus-stack
spec:
interval: 5m
chart:
spec:
version: "48.x"
chart: kube-prometheus-stack
sourceRef:
kind: HelmRepository
name: prometheus-community
interval: 60m
install:
crds: Create
upgrade:
crds: CreateReplace
# https://github.com/prometheus-community/helm-charts/blob/main/charts/kube-prometheus-stack/values.yaml
values:
alertmanager:
enabled: false
prometheus:
prometheusSpec:
retention: 24h
resources:
requests:
cpu: 200m
memory: 200Mi
podMonitorNamespaceSelector: {}
podMonitorSelector:
matchLabels:
app.kubernetes.io/component: monitoring
grafana:
defaultDashboardsEnabled: false
kube-state-metrics:
collectors: []
extraArgs:
- --custom-resource-state-only=true
rbac:
extraRules:
- apiGroups:
- source.toolkit.fluxcd.io
- kustomize.toolkit.fluxcd.io
- helm.toolkit.fluxcd.io
- image.toolkit.fluxcd.io
- notification.toolkit.fluxcd.io
resources:
- gitrepositories
- buckets
- helmrepositories
- helmcharts
- ocirepositories
- kustomizations
- helmreleases
- imagerepositories
- imagepolicies
- imageupdateautomations
- alerts
- providers
- receivers
verbs: ["list", "watch"]
customResourceState:
enabled: true
config:
spec:
resources:
- &metric
groupVersionKind:
group: source.toolkit.fluxcd.io
version: "v1"
kind: GitRepository
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- <<: *metric
groupVersionKind:
group: source.toolkit.fluxcd.io
version: "v1beta2"
kind: Bucket
- <<: *metric
groupVersionKind:
group: source.toolkit.fluxcd.io
version: "v1beta2"
kind: HelmRepository
- <<: *metric
groupVersionKind:
group: source.toolkit.fluxcd.io
version: "v1beta2"
kind: HelmChart
- <<: *metric
groupVersionKind:
group: source.toolkit.fluxcd.io
version: "v1beta2"
kind: OCIRepository
- <<: *metric
groupVersionKind:
group: kustomize.toolkit.fluxcd.io
version: "v1"
kind: Kustomization
- <<: *metric
groupVersionKind:
group: helm.toolkit.fluxcd.io
version: "v2beta1"
kind: HelmRelease
- <<: *metric
groupVersionKind:
group: image.toolkit.fluxcd.io
version: "v1beta2"
kind: ImageRepository
- <<: *metric
groupVersionKind:
group: image.toolkit.fluxcd.io
version: "v1beta2"
kind: ImagePolicy
- <<: *metric
groupVersionKind:
group: image.toolkit.fluxcd.io
version: "v1beta1"
kind: ImageUpdateAutomation
- <<: *metric
groupVersionKind:
group: notification.toolkit.fluxcd.io
version: "v1beta2"
kind: Alert
- <<: *metric
groupVersionKind:
group: notification.toolkit.fluxcd.io
version: "v1beta2"
kind: Provider
- <<: *metric
groupVersionKind:
group: notification.toolkit.fluxcd.io
version: "v1"
kind: Receiver
postRenderers:
- kustomize:
patches:
- target:
# Ignore these objects from Flux diff as they are mutated from chart hooks
kind: (ValidatingWebhookConfiguration|MutatingWebhookConfiguration)
name: kube-prometheus-stack-admission
patch: |
- op: add
path: /metadata/annotations/helm.toolkit.fluxcd.io~1driftDetection
value: disabled
- target:
# Ignore these objects from Flux diff as they are mutated at apply time but not at dry-run time
kind: PrometheusRule
patch: |
- op: add
path: /metadata/annotations/helm.toolkit.fluxcd.io~1driftDetection
value: disabled
8 changes: 8 additions & 0 deletions kube-prometheus-stack/repository.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
name: prometheus-community
spec:
interval: 120m
type: default
url: https://prometheus-community.github.io/helm-charts
6 changes: 6 additions & 0 deletions loki-stack/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: monitoring
resources:
- repository.yaml
- release.yaml
34 changes: 34 additions & 0 deletions loki-stack/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: loki-stack
spec:
interval: 5m
dependsOn:
- name: kube-prometheus-stack
chart:
spec:
version: "2.x"
chart: loki-stack
sourceRef:
kind: HelmRepository
name: grafana-charts
interval: 60m
# https://github.com/grafana/helm-charts/blob/main/charts/loki-stack/values.yaml
# https://github.com/grafana/loki/blob/main/production/helm/loki/values.yaml
values:
promtail:
enabled: true
loki:
enabled: true
isDefault: false
serviceMonitor:
enabled: true
additionalLabels:
app.kubernetes.io/part-of: kube-prometheus-stack
config:
chunk_store_config:
max_look_back_period: 0s
table_manager:
retention_deletes_enabled: true
retention_period: 12h
7 changes: 7 additions & 0 deletions loki-stack/repository.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
name: grafana-charts
spec:
interval: 120m0s
url: https://grafana.github.io/helm-charts
Loading

0 comments on commit acd76e1

Please sign in to comment.