-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(logging-apps): replace loki-stack with loki and promtail (#1147)
- Loading branch information
Showing
9 changed files
with
271 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: {} | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 -}} |
Oops, something went wrong.