Skip to content

Commit

Permalink
feat(logging-apps): replace loki-stack with loki and promtail (#1147)
Browse files Browse the repository at this point in the history
  • Loading branch information
hairmare authored Nov 16, 2023
1 parent ce05fbe commit 40c4ae4
Show file tree
Hide file tree
Showing 9 changed files with 271 additions and 113 deletions.
90 changes: 4 additions & 86 deletions charts/logging-apps/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: logging-apps
description: Argo CD app-of-apps config for logging applications
type: application
version: 0.27.0
version: 0.28.0
home: https://github.com/adfinis/helm-charts/tree/main/charts/logging-apps
sources:
- https://github.com/adfinis/helm-charts
Expand All @@ -17,89 +17,7 @@ dependencies:
annotations:
artifacthub.io/changes: |
- kind: changed
description: 'chore(fluentBit): update chart from 0.21.6 to 0.39.0'
description: 'feat: replace loki-stack with loki and promtail'
links:
- name: GitHub release of helm-chart 0.39.0
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.39.0
- name: GitHub release of Fluent Bit v2.1.10
url: https://github.com/fluent/fluent-bit/releases/tag/v2.1.10
- name: GitHub release of helm-chart 0.38.0
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.38.0
- name: GitHub release of Fluent Bit v2.1.9
url: https://github.com/fluent/fluent-bit/releases/tag/v2.1.9
- name: GitHub release of helm-chart 0.37.1
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.37.1
- name: GitHub release of Fluent Bit v2.1.8
url: https://github.com/fluent/fluent-bit/releases/tag/v2.1.8
- name: GitHub release of helm-chart 0.37.0
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.37.0
- name: GitHub release of helm-chart 0.36.0
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.36.0
- name: GitHub release of Fluent Bit v2.1.7
url: https://github.com/fluent/fluent-bit/releases/tag/v2.1.7
- name: GitHub release of helm-chart 0.35.1
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.35.1
- name: GitHub release of helm-chart 0.35.0
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.35.0
- name: GitHub release of helm-chart 0.34.2
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.34.2
- name: GitHub release of Fluent Bit v2.1.6
url: https://github.com/fluent/fluent-bit/releases/tag/v2.1.6
- name: GitHub release of helm-chart 0.34.1
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.34.1
- name: GitHub release of helm-chart 0.34.0
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.34.0
- name: GitHub release of helm-chart 0.33.0
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.33.0
- name: GitHub release of helm-chart 0.32.2
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.32.2
- name: GitHub release of Fluent Bit v2.1.5
url: https://github.com/fluent/fluent-bit/releases/tag/v2.1.5
- name: GitHub release of helm-chart 0.32.1
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.32.1
- name: GitHub release of helm-chart 0.32.0
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.32.0
- name: GitHub release of helm-chart 0.31.0
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.31.0
- name: GitHub release of helm-chart 0.30.4
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.30.4
- name: GitHub release of Fluent Bit v2.1.4
url: https://github.com/fluent/fluent-bit/releases/tag/v2.1.4
- name: GitHub release of helm-chart 0.30.3
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.30.3
- name: GitHub release of helm-chart 0.30.2
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.30.2
- name: GitHub release of helm-chart 0.30.1
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.30.1
- name: GitHub release of helm-chart 0.30.0
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.30.0
- name: GitHub release of helm-chart 0.29.0
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.29.0
- name: GitHub release of Fluent Bit v2.1.3
url: https://github.com/fluent/fluent-bit/releases/tag/v2.1.3
- name: GitHub release of helm-chart 0.28.0
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.28.0
- name: GitHub release of Fluent Bit v2.1.2
url: https://github.com/fluent/fluent-bit/releases/tag/v2.1.2
- name: GitHub release of helm-chart 0.27.0
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.27.0
- name: GitHub release of Fluent Bit v2.0.11
url: https://github.com/fluent/fluent-bit/releases/tag/v2.0.11
- name: GitHub release of helm-chart 0.26.0
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.26.0
- name: GitHub release of helm-chart 0.25.0
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.25.0
- name: GitHub release of Fluent Bit v2.0.10
url: https://github.com/fluent/fluent-bit/releases/tag/v2.0.10
- name: GitHub release of helm-chart 0.24.0
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.24.0
- name: GitHub release of Fluent Bit v2.0.9
url: https://github.com/fluent/fluent-bit/releases/tag/v2.0.9
- name: GitHub release of helm-chart 0.23.0
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.23.0
- name: GitHub release of Fluent Bit v2.0.8
url: https://github.com/fluent/fluent-bit/releases/tag/v2.0.8
- name: GitHub release of helm-chart 0.22.0
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.22.0
- name: GitHub release of helm-chart 0.21.7
url: https://github.com/fluent/helm-charts/releases/tag/fluent-bit-0.21.7
- name: Issue
url: https://github.com/adfinis/helm-charts/issues/1058
26 changes: 17 additions & 9 deletions charts/logging-apps/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions charts/logging-apps/ci/default-values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
lokiStack:
enabled: false
values: {}

loki:
enabled: true
values: {}

promtail:
enabled: true
values: {}

Expand Down
10 changes: 0 additions & 10 deletions charts/logging-apps/examples/loki-stack.yaml

This file was deleted.

105 changes: 105 additions & 0 deletions charts/logging-apps/examples/loki.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Deploy Loki using Azure blob as backing store

loki:
enabled: true
project: infra-logging
values:
test:
# TODO: enable this together with selfMonitoring when you deploy loki!
enabled: false
monitoring:
selfMonitoring:
enabled: false
grafanaAgent:
installOperator: false
serviceMonitor:
enabled: true
labels:
k8s.adfinis.com/prometheus: kube-prometheus
lokiCanary:
enabled: false
loki:
# TODO: enable auth!
auth_enabled: false
commonConfig:
# The default is /var/loki and as we have no persistent volume
# mounted startup fails because the location is read-only.
# TODO: Review which potential problems this could cause with loss
# of data when a pod is restarted.
path_prefix: /tmp/loki
# We're using a custom schema config, because we want to directly start using
# TSDB to avoid having to migrate from boltdb-shipper once it's deprecated.
schemaConfig:
configs:
- from: 2023-06-23
store: tsdb
object_store: azure
schema: v12
index:
prefix: loki_index_
period: 24h
storage_config:
# TODO: configure a proper Azure Blob store
azure:
account_name: <TODO>
account_key: ${ARM_ACCESS_KEY}
container_name: <TODO>
endpoint_suffix: blob.core.windows.net
tsdb_shipper:
shared_store: azure
table_manager:
retention_deletes_enabled: true
retention_period: 30d
singleBinary:
replicas: 3
persistence:
enabled: false
extraArgs:
# Required so that ${ARM_ACCESS_KEY} above is expanded using the
# environment variable configured in the secret below.
- "-config.expand-env=true"
extraEnvFrom:
# Should contain a single key: ARM_ACCESS_KEY containing the access
# key for the storage account.
- secretRef:
name: loki-objectstorage-credentials
serviceMonitor:
enabled: true
additionalLabels:
k8s.adfinis.com/prometheus: kube-prometheus
prometheusRule:
additionalLabels:
k8s.adfinis.com/prometheus: kube-prometheus
rules:
- alert: LokiProcessTooManyRestarts
expr: changes(process_start_time_seconds{job=~"loki"}[15m]) > 2
for: 0m
labels:
severity: warning
annotations:
summary: Loki process too many restarts (instance {{ $labels.instance }})
description: "A loki process had too many restarts (target {{ $labels.instance }})\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
- alert: LokiRequestErrors
expr: 100 * sum(rate(loki_request_duration_seconds_count{status_code=~"5.."}[1m])) by (namespace, job, route) / sum(rate(loki_request_duration_seconds_count[1m])) by (namespace, job, route) > 10
for: 15m
labels:
severity: critical
annotations:
summary: Loki request errors (instance {{ $labels.instance }})
description: "The {{ $labels.job }} and {{ $labels.route }} are experiencing errors\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
- alert: LokiRequestPanic
expr: sum(increase(loki_panic_total[10m])) by (namespace, job) > 0
for: 5m
labels:
severity: critical
annotations:
summary: Loki request panic (instance {{ $labels.instance }})
description: "The {{ $labels.job }} is experiencing {{ printf \"%.2f\" $value }}% increase of panics\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
- alert: LokiRequestLatency
expr: (histogram_quantile(0.99, sum(rate(loki_request_duration_seconds_bucket{route!~"(?i).*tail.*"}[5m])) by (le))) > 1
for: 5m
labels:
severity: critical
annotations:
summary: Loki request latency (instance {{ $labels.instance }})
description: "The {{ $labels.job }} {{ $labels.route }} is experiencing {{ printf \"%.2f\" $value }}s 99th percentile latency\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
31 changes: 31 additions & 0 deletions charts/logging-apps/examples/promtail.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Deploy a promtail instance that is monitored by kube-prometheus-stack

promtail:
enabled: true
project: infra-logging
values:
serviceMonitor:
enabled: true
labels:
k8s.adfinis.com/prometheus: kube-prometheus
prometheusRule:
enabled: true
additionalLabels:
k8s.adfinis.com/prometheus: kube-prometheus
rules:
- alert: PromtailRequestErrors
expr: 100 * sum(rate(promtail_request_duration_seconds_count{status_code=~"5..|failed"}[1m])) by (namespace, job, route, instance) / sum(rate(promtail_request_duration_seconds_count[1m])) by (namespace, job, route, instance) > 10
for: 5m
labels:
severity: critical
annotations:
summary: Promtail request errors (instance {{ $labels.instance }})
description: "The {{ $labels.job }} {{ $labels.route }} is experiencing {{ printf \"%.2f\" $value }}% errors.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
- alert: PromtailRequestLatency
expr: histogram_quantile(0.99, sum(rate(promtail_request_duration_seconds_bucket[5m])) by (le)) > 1
for: 5m
labels:
severity: critical
annotations:
summary: Promtail request latency (instance {{ $labels.instance }})
description: "The {{ $labels.job }} {{ $labels.route }} is experiencing {{ printf \"%.2f\" $value }}s 99th percentile latency.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
33 changes: 33 additions & 0 deletions charts/logging-apps/templates/loki.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{ if .Values.loki.enabled }}
{{ template "argoconfig.application" (list . "logging-apps.loki") }}
{{ end }}

{{- define "logging-apps.loki" -}}{{- $app := unset .Values.loki "enabled" -}}{{- $name := default $app.destination.namespace $app.name -}}
metadata:
name: {{ template "common.fullname" . }}-{{ $name }}
spec:
{{- if $app.project }}
project: {{ $app.project | quote }}
{{- end }}
source:
repoURL: {{ $app.repoURL | quote }}
chart: {{ $app.chart | quote }}
targetRevision: {{ $app.targetRevision | quote }}
helm:
releaseName: {{ $name | quote }}
values: |-
nameOverride: {{ $name | quote }}
{{- $app.values | toYaml | nindent 8 }}
{{- if $app.destination }}
destination:
{{ $app.destination | toYaml | nindent 4 }}
{{- end }}
{{- if $app.syncPolicy }}
syncPolicy:
{{ $app.syncPolicy | toYaml | nindent 4 }}
{{- end }}
{{- if $app.ignoreDifferences }}
ignoreDifferences:
{{ $app.ignoreDifferences | toYaml | nindent 4 }}
{{- end }}
{{- end -}}
33 changes: 33 additions & 0 deletions charts/logging-apps/templates/promtail.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{ if .Values.promtail.enabled }}
{{ template "argoconfig.application" (list . "logging-apps.promtail") }}
{{ end }}

{{- define "logging-apps.promtail" -}}{{- $app := unset .Values.promtail "enabled" -}}{{- $name := default $app.destination.namespace $app.name -}}
metadata:
name: {{ template "common.fullname" . }}-{{ $name }}
spec:
{{- if $app.project }}
project: {{ $app.project | quote }}
{{- end }}
source:
repoURL: {{ $app.repoURL | quote }}
chart: {{ $app.chart | quote }}
targetRevision: {{ $app.targetRevision | quote }}
helm:
releaseName: {{ $name | quote }}
values: |-
nameOverride: {{ $name | quote }}
{{- $app.values | toYaml | nindent 8 }}
{{- if $app.destination }}
destination:
{{ $app.destination | toYaml | nindent 4 }}
{{- end }}
{{- if $app.syncPolicy }}
syncPolicy:
{{ $app.syncPolicy | toYaml | nindent 4 }}
{{- end }}
{{- if $app.ignoreDifferences }}
ignoreDifferences:
{{ $app.ignoreDifferences | toYaml | nindent 4 }}
{{- end }}
{{- end -}}
Loading

0 comments on commit 40c4ae4

Please sign in to comment.