From 0cdbc90ae3cee9eecbc60c9daf1acb672859af14 Mon Sep 17 00:00:00 2001 From: Teddy Andrieux Date: Thu, 26 Nov 2020 11:11:02 +0100 Subject: [PATCH 1/5] charts/fluent-bit: Do not force the image tag used during rendering For fluent-bit charts do not override the image tag in the `fluent-bit.yaml` option helm file, instead let the default one define in the `values.yaml` of the helm chart --- charts/fluent-bit.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/charts/fluent-bit.yaml b/charts/fluent-bit.yaml index 0d7655a7f7..58a0be0ff5 100644 --- a/charts/fluent-bit.yaml +++ b/charts/fluent-bit.yaml @@ -51,7 +51,6 @@ deploymentStrategy: RollingUpdate image: repository: '__image__(fluent-bit-plugin-loki)' - tag: 1.5.0-amd64 pullPolicy: IfNotPresent nameOverride: fluent-bit From e94336e817087a8a3b102613c643bc8261146243 Mon Sep 17 00:00:00 2001 From: Teddy Andrieux Date: Wed, 25 Nov 2020 17:33:05 +0100 Subject: [PATCH 2/5] chart,build: update `fluent-bit` to 2.0.1 Update the image downloaded in the buildchain for fluent-bit. Update fluent-bit chart using: ``` rm -rf charts/fluent-bit helm repo add loki https://grafana.github.io/loki/charts helm repo update helm fetch -d charts --untar loki/fluent-bit ``` And then re-rendering using: ``` ./charts/render.py fluent-bit --namespace metalk8s-logging \ --remove-manifest ConfigMap fluent-bit \ charts/fluent-bit.yaml charts/fluent-bit/ \ > salt/metalk8s/addons/logging/fluent-bit/deployed/chart.sls ``` --- buildchain/buildchain/versions.py | 4 ++-- charts/fluent-bit/.helmignore | 0 charts/fluent-bit/Chart.yaml | 7 +++--- charts/fluent-bit/README.md | 2 ++ charts/fluent-bit/templates/NOTES.txt | 0 charts/fluent-bit/templates/_helpers.tpl | 0 charts/fluent-bit/templates/clusterrole.yaml | 0 .../templates/clusterrolebinding.yaml | 0 charts/fluent-bit/templates/configmap.yaml | 5 +++-- charts/fluent-bit/templates/daemonset.yaml | 10 +++++++-- .../templates/podsecuritypolicy.yaml | 0 charts/fluent-bit/templates/role.yaml | 0 charts/fluent-bit/templates/rolebinding.yaml | 0 .../templates/service-headless.yaml | 0 .../fluent-bit/templates/serviceaccount.yaml | 0 .../fluent-bit/templates/servicemonitor.yaml | 0 charts/fluent-bit/values.yaml | 11 ++++++++-- .../logging/fluent-bit/deployed/chart.sls | 22 +++++++++---------- 18 files changed, 38 insertions(+), 23 deletions(-) mode change 100755 => 100644 charts/fluent-bit/.helmignore mode change 100755 => 100644 charts/fluent-bit/Chart.yaml mode change 100755 => 100644 charts/fluent-bit/README.md mode change 100755 => 100644 charts/fluent-bit/templates/NOTES.txt mode change 100755 => 100644 charts/fluent-bit/templates/_helpers.tpl mode change 100755 => 100644 charts/fluent-bit/templates/clusterrole.yaml mode change 100755 => 100644 charts/fluent-bit/templates/clusterrolebinding.yaml mode change 100755 => 100644 charts/fluent-bit/templates/configmap.yaml mode change 100755 => 100644 charts/fluent-bit/templates/daemonset.yaml mode change 100755 => 100644 charts/fluent-bit/templates/podsecuritypolicy.yaml mode change 100755 => 100644 charts/fluent-bit/templates/role.yaml mode change 100755 => 100644 charts/fluent-bit/templates/rolebinding.yaml mode change 100755 => 100644 charts/fluent-bit/templates/service-headless.yaml mode change 100755 => 100644 charts/fluent-bit/templates/serviceaccount.yaml mode change 100755 => 100644 charts/fluent-bit/templates/servicemonitor.yaml mode change 100755 => 100644 charts/fluent-bit/values.yaml diff --git a/buildchain/buildchain/versions.py b/buildchain/buildchain/versions.py index 4e2371a126..6bf4e1c01d 100644 --- a/buildchain/buildchain/versions.py +++ b/buildchain/buildchain/versions.py @@ -224,8 +224,8 @@ def _version_prefix(version: str, prefix: str = 'v') -> str: ), Image( name='fluent-bit-plugin-loki', - version='1.5.0-amd64', - digest='sha256:2d0e9b06a2bf894fa91300fa38a185ac44a7bedcb8a2c63b8f6077e5cf80fc4d', + version='1.6.0-amd64', + digest='sha256:cb1cd95d0fcf76b626623684f0c8b204a9f773443650c7b3d243b96c29ff7020', ), ) diff --git a/charts/fluent-bit/.helmignore b/charts/fluent-bit/.helmignore old mode 100755 new mode 100644 diff --git a/charts/fluent-bit/Chart.yaml b/charts/fluent-bit/Chart.yaml old mode 100755 new mode 100644 index 1a83b32f67..16054392db --- a/charts/fluent-bit/Chart.yaml +++ b/charts/fluent-bit/Chart.yaml @@ -1,10 +1,9 @@ apiVersion: v1 -appVersion: v1.5.0 +appVersion: v2.0.0 description: Uses fluent-bit Loki go plugin for gathering logs and sending them to Loki -engine: gotpl home: https://grafana.com/loki -icon: https://github.com/grafana/loki/raw/master/docs/logo.png +icon: https://raw.githubusercontent.com/grafana/loki/master/docs/sources/logo.png kubeVersion: ^1.10.0-0 maintainers: - email: lokiproject@googlegroups.com @@ -12,4 +11,4 @@ maintainers: name: fluent-bit sources: - https://github.com/grafana/loki -version: 0.1.5 +version: 2.0.1 diff --git a/charts/fluent-bit/README.md b/charts/fluent-bit/README.md old mode 100755 new mode 100644 index 858205d948..8af1a8fe2f --- a/charts/fluent-bit/README.md +++ b/charts/fluent-bit/README.md @@ -83,6 +83,8 @@ For more details, read the [Fluent Bit documentation](../../../cmd/fluent-bit/RE | `config.loglevel` | the Fluent Bit log level (debug,info,warn,error). | `warn` | | `config.lineFormat` | The line format to use to send a record (json/key_value) | `json` | | `config.k8sLoggingParser`| Allow Kubernetes Pods to suggest a pre-defined Parser. See [Official Fluent Bit documentation](https://docs.fluentbit.io/manual/filter/kubernetes#kubernetes-annotations). | `Off` | +| `config.k8sLoggingExclude`| Allow Kubernetes Pods to exclude their logs from the log processor. See [Official Fluent Bit documentation](https://docs.fluentbit.io/manual/pipeline/filters/kubernetes) | `Off` +| `config.memBufLimit` | Override the default Mem_Buf_Limit [Official Fluent Bit documentation](https://docs.fluentbit.io/manual/administration/backpressure#mem_buf_limit) | `5MB` | `config.removeKeys` | The list of key to remove from each record | `[removeKeys,stream]` | | `config.labels` | A set of labels to send for every log | `'{job="fluent-bit"}'` | | `config.autoKubernetesLabels` | If set to true, it will add all Kubernetes labels to Loki labels | `false` | diff --git a/charts/fluent-bit/templates/NOTES.txt b/charts/fluent-bit/templates/NOTES.txt old mode 100755 new mode 100644 diff --git a/charts/fluent-bit/templates/_helpers.tpl b/charts/fluent-bit/templates/_helpers.tpl old mode 100755 new mode 100644 diff --git a/charts/fluent-bit/templates/clusterrole.yaml b/charts/fluent-bit/templates/clusterrole.yaml old mode 100755 new mode 100644 diff --git a/charts/fluent-bit/templates/clusterrolebinding.yaml b/charts/fluent-bit/templates/clusterrolebinding.yaml old mode 100755 new mode 100644 diff --git a/charts/fluent-bit/templates/configmap.yaml b/charts/fluent-bit/templates/configmap.yaml old mode 100755 new mode 100644 index 3022647906..23fdba80e6 --- a/charts/fluent-bit/templates/configmap.yaml +++ b/charts/fluent-bit/templates/configmap.yaml @@ -24,12 +24,13 @@ data: Path /var/log/containers/*.log Parser docker DB /run/fluent-bit/flb_kube.db - Mem_Buf_Limit 5MB + Mem_Buf_Limit {{ .Values.config.memBufLimit }} [FILTER] Name kubernetes Match kube.* Kube_URL https://kubernetes.default.svc:443 Merge_Log On + K8S-Logging.Exclude {{ .Values.config.k8sLoggingExclude }} K8S-Logging.Parser {{ .Values.config.k8sLoggingParser }} [Output] Name loki @@ -41,7 +42,7 @@ data: {{- end }} TenantID {{ .Values.config.tenantID }} BatchWait {{ .Values.config.batchWait }} - BatchSize {{ .Values.config.batchSize }} + BatchSize {{ int .Values.config.batchSize }} Labels {{ .Values.config.labels }} RemoveKeys {{ include "helm-toolkit.utils.joinListWithComma" .Values.config.removeKeys }} AutoKubernetesLabels {{ .Values.config.autoKubernetesLabels }} diff --git a/charts/fluent-bit/templates/daemonset.yaml b/charts/fluent-bit/templates/daemonset.yaml old mode 100755 new mode 100644 index e57b53232c..6652c29646 --- a/charts/fluent-bit/templates/daemonset.yaml +++ b/charts/fluent-bit/templates/daemonset.yaml @@ -35,9 +35,15 @@ spec: {{- end }} spec: serviceAccountName: {{ template "fluent-bit-loki.serviceAccountName" . }} - {{- if .Values.priorityClassName }} + {{- if .Values.priorityClassName }} priorityClassName: {{ .Values.priorityClassName }} - {{- end }} + {{- end }} + {{- if .Values.image.pullSecrets }} + imagePullSecrets: + {{- range .Values.image.pullSecrets }} + - name: {{ . }} + {{- end }} + {{- end }} containers: - name: fluent-bit-loki image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" diff --git a/charts/fluent-bit/templates/podsecuritypolicy.yaml b/charts/fluent-bit/templates/podsecuritypolicy.yaml old mode 100755 new mode 100644 diff --git a/charts/fluent-bit/templates/role.yaml b/charts/fluent-bit/templates/role.yaml old mode 100755 new mode 100644 diff --git a/charts/fluent-bit/templates/rolebinding.yaml b/charts/fluent-bit/templates/rolebinding.yaml old mode 100755 new mode 100644 diff --git a/charts/fluent-bit/templates/service-headless.yaml b/charts/fluent-bit/templates/service-headless.yaml old mode 100755 new mode 100644 diff --git a/charts/fluent-bit/templates/serviceaccount.yaml b/charts/fluent-bit/templates/serviceaccount.yaml old mode 100755 new mode 100644 diff --git a/charts/fluent-bit/templates/servicemonitor.yaml b/charts/fluent-bit/templates/servicemonitor.yaml old mode 100755 new mode 100644 diff --git a/charts/fluent-bit/values.yaml b/charts/fluent-bit/values.yaml old mode 100755 new mode 100644 index 2138c888cb..4c7e8bc9fb --- a/charts/fluent-bit/values.yaml +++ b/charts/fluent-bit/values.yaml @@ -10,10 +10,12 @@ config: port: 2020 tenantID: '""' batchWait: 1 - batchSize: 10240 + batchSize: 1048576 loglevel: warn lineFormat: json + k8sLoggingExclude: "Off" k8sLoggingParser: "Off" + memBufLimit: "5MB" removeKeys: - kubernetes - stream @@ -48,8 +50,13 @@ deploymentStrategy: RollingUpdate image: repository: grafana/fluent-bit-plugin-loki - tag: 1.5.0-amd64 + tag: 1.6.0-amd64 pullPolicy: IfNotPresent + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be present in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + # pullSecrets: + # - myRegistrKeySecretName nameOverride: fluent-bit-loki diff --git a/salt/metalk8s/addons/logging/fluent-bit/deployed/chart.sls b/salt/metalk8s/addons/logging/fluent-bit/deployed/chart.sls index 9852ad19fa..e6d12c7fb9 100644 --- a/salt/metalk8s/addons/logging/fluent-bit/deployed/chart.sls +++ b/salt/metalk8s/addons/logging/fluent-bit/deployed/chart.sls @@ -14,7 +14,7 @@ metadata: app.kubernetes.io/managed-by: salt app.kubernetes.io/name: fluent-bit app.kubernetes.io/part-of: metalk8s - chart: fluent-bit-0.1.5 + chart: fluent-bit-2.0.1 heritage: metalk8s release: fluent-bit name: fluent-bit @@ -51,7 +51,7 @@ metadata: app.kubernetes.io/managed-by: salt app.kubernetes.io/name: fluent-bit app.kubernetes.io/part-of: metalk8s - chart: fluent-bit-0.1.5 + chart: fluent-bit-2.0.1 heritage: metalk8s release: fluent-bit name: fluent-bit @@ -65,7 +65,7 @@ metadata: app.kubernetes.io/managed-by: salt app.kubernetes.io/name: fluent-bit app.kubernetes.io/part-of: metalk8s - chart: fluent-bit-0.1.5 + chart: fluent-bit-2.0.1 heritage: metalk8s release: fluent-bit name: fluent-bit-clusterrole @@ -89,7 +89,7 @@ metadata: app.kubernetes.io/managed-by: salt app.kubernetes.io/name: fluent-bit app.kubernetes.io/part-of: metalk8s - chart: fluent-bit-0.1.5 + chart: fluent-bit-2.0.1 heritage: metalk8s release: fluent-bit name: fluent-bit-clusterrolebinding @@ -111,7 +111,7 @@ metadata: app.kubernetes.io/managed-by: salt app.kubernetes.io/name: fluent-bit app.kubernetes.io/part-of: metalk8s - chart: fluent-bit-0.1.5 + chart: fluent-bit-2.0.1 heritage: metalk8s release: fluent-bit name: fluent-bit @@ -134,7 +134,7 @@ metadata: app.kubernetes.io/managed-by: salt app.kubernetes.io/name: fluent-bit app.kubernetes.io/part-of: metalk8s - chart: fluent-bit-0.1.5 + chart: fluent-bit-2.0.1 heritage: metalk8s release: fluent-bit name: fluent-bit @@ -155,7 +155,7 @@ metadata: app.kubernetes.io/managed-by: salt app.kubernetes.io/name: fluent-bit app.kubernetes.io/part-of: metalk8s - chart: fluent-bit-0.1.5 + chart: fluent-bit-2.0.1 heritage: metalk8s release: fluent-bit name: fluent-bit-headless @@ -180,7 +180,7 @@ metadata: app.kubernetes.io/managed-by: salt app.kubernetes.io/name: fluent-bit app.kubernetes.io/part-of: metalk8s - chart: fluent-bit-0.1.5 + chart: fluent-bit-2.0.1 heritage: metalk8s release: fluent-bit name: fluent-bit @@ -193,7 +193,7 @@ spec: template: metadata: annotations: - checksum/config: 7f68240acb36d458b00bb6871eaee1d88726c42f12d28c597564b856f9b9ac4f + checksum/config: 3bed338de62965258211f9a86544e9b6437e23d31787a38f9051656e4a6e68c9 prometheus.io/path: /api/v1/metrics/prometheus prometheus.io/port: '2020' prometheus.io/scrape: 'true' @@ -203,7 +203,7 @@ spec: spec: affinity: {} containers: - - image: {% endraw -%}{{ build_image_name("fluent-bit-plugin-loki", False) }}{%- raw %}:1.5.0-amd64 + - image: {% endraw -%}{{ build_image_name("fluent-bit-plugin-loki", False) }}{%- raw %}:1.6.0-amd64 imagePullPolicy: IfNotPresent name: fluent-bit-loki ports: @@ -266,7 +266,7 @@ metadata: app.kubernetes.io/managed-by: salt app.kubernetes.io/name: fluent-bit app.kubernetes.io/part-of: metalk8s - chart: fluent-bit-0.1.5 + chart: fluent-bit-2.0.1 heritage: metalk8s release: prometheus-operator name: fluent-bit From dade39722e208a3d1c10568d944a80849b87c49d Mon Sep 17 00:00:00 2001 From: Teddy Andrieux Date: Thu, 26 Nov 2020 09:30:34 +0100 Subject: [PATCH 3/5] charts/loki: Do not force the image tag used during rendering For loki charts do not override the image tag in the `loki.yaml` option helm file, instead let the default one define in the `values.yaml` of the helm chart --- charts/loki.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/charts/loki.yaml b/charts/loki.yaml index 355f1ff4fe..3f8059c42d 100644 --- a/charts/loki.yaml +++ b/charts/loki.yaml @@ -1,6 +1,5 @@ image: repository: '__image__(loki)' - tag: 1.5.0 pullPolicy: IfNotPresent ## Optionally specify an array of imagePullSecrets. From 6378dd70df7318d6acac2ab9c0b59293c55ee15c Mon Sep 17 00:00:00 2001 From: Teddy Andrieux Date: Wed, 25 Nov 2020 17:46:03 +0100 Subject: [PATCH 4/5] chart,build: update `loki` to 2.1.0 Update the image downloaded in the buildchain for loki. Update loki chart using: ``` rm -rf charts/loki helm repo add loki https://grafana.github.io/loki/charts helm repo update helm fetch -d charts --untar loki/loki ``` And then re-rendering using: ``` ./charts/render.py loki charts/loki.yaml charts/loki/ \ --remove-manifest Secret loki \ --namespace metalk8s-logging \ --service-config loki metalk8s-loki-config \ metalk8s/addons/logging/loki/config/loki.yaml \ metalk8s-logging \ > salt/metalk8s/addons/logging/loki/deployed/chart.sls ``` --- buildchain/buildchain/versions.py | 4 +- charts/loki/Chart.yaml | 7 ++- charts/loki/README.md | 5 ++ charts/loki/templates/service-headless.yaml | 2 +- charts/loki/templates/service.yaml | 2 +- charts/loki/templates/statefulset.yaml | 14 +++++- charts/loki/values.yaml | 46 ++++++++++++++++--- .../addons/logging/loki/deployed/chart.sls | 18 ++++---- 8 files changed, 73 insertions(+), 25 deletions(-) diff --git a/buildchain/buildchain/versions.py b/buildchain/buildchain/versions.py index 6bf4e1c01d..bff7b215f4 100644 --- a/buildchain/buildchain/versions.py +++ b/buildchain/buildchain/versions.py @@ -219,8 +219,8 @@ def _version_prefix(version: str, prefix: str = 'v') -> str: ), Image( name='loki', - version='1.5.0', - digest='sha256:922b3f412fdd9a8fb01115b6aebf5dac162647ce1c5ee3637ce1e2cff69e097b', + version='2.0.0', + digest='sha256:77e138f81a8e253f1d0ea5d2dc329a02212ecab3247c87f85f1f2182a0160ccd', ), Image( name='fluent-bit-plugin-loki', diff --git a/charts/loki/Chart.yaml b/charts/loki/Chart.yaml index eb5aabd05d..ad067e8ff5 100644 --- a/charts/loki/Chart.yaml +++ b/charts/loki/Chart.yaml @@ -1,9 +1,8 @@ apiVersion: v1 -appVersion: v1.5.0 +appVersion: v2.0.0 description: 'Loki: like Prometheus, but for logs.' -engine: gotpl home: https://grafana.com/loki -icon: https://github.com/grafana/loki/raw/master/docs/logo.png +icon: https://raw.githubusercontent.com/grafana/loki/master/docs/sources/logo.png kubeVersion: ^1.10.0-0 maintainers: - email: lokiproject@googlegroups.com @@ -11,4 +10,4 @@ maintainers: name: loki sources: - https://github.com/grafana/loki -version: 0.30.2 +version: 2.1.0 diff --git a/charts/loki/README.md b/charts/loki/README.md index 9d0cd692af..56def3dd99 100644 --- a/charts/loki/README.md +++ b/charts/loki/README.md @@ -60,3 +60,8 @@ tls: - {{ .Values.ingress.host }} ``` +## Use Loki Alerting + +You can add your own alerting rules with `alerting_groups` in `values.yaml`. This will create a ConfigMap with your rules and additional volumes and mounts for Loki. + +This does **not** enable the Loki `ruler` component which does the evaluation of your rules. The `values.yaml` file does contain a simple example. For more details take a look at the official [alerting docs](https://grafana.com/docs/loki/latest/alerting/). \ No newline at end of file diff --git a/charts/loki/templates/service-headless.yaml b/charts/loki/templates/service-headless.yaml index 644f527625..1efdde60fd 100644 --- a/charts/loki/templates/service-headless.yaml +++ b/charts/loki/templates/service-headless.yaml @@ -15,7 +15,7 @@ spec: - port: {{ .Values.service.port }} protocol: TCP name: http-metrics - targetPort: http-metrics + targetPort: {{ .Values.service.targetPort }} {{- if .Values.extraPorts }} {{ toYaml .Values.extraPorts | indent 4}} {{- end }} diff --git a/charts/loki/templates/service.yaml b/charts/loki/templates/service.yaml index 2eb419c02f..d6ee92d974 100644 --- a/charts/loki/templates/service.yaml +++ b/charts/loki/templates/service.yaml @@ -31,7 +31,7 @@ spec: - port: {{ .Values.service.port }} protocol: TCP name: http-metrics - targetPort: http-metrics + targetPort: {{ .Values.service.targetPort }} {{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }} nodePort: {{ .Values.service.nodePort }} {{- end }} diff --git a/charts/loki/templates/statefulset.yaml b/charts/loki/templates/statefulset.yaml index 5511a380e9..75d84ced54 100644 --- a/charts/loki/templates/statefulset.yaml +++ b/charts/loki/templates/statefulset.yaml @@ -67,6 +67,12 @@ spec: - name: storage mountPath: "/data" subPath: {{ .Values.persistence.subPath }} + {{- if gt (len .Values.alerting_groups) 0 }} + - name: scratch + mountPath: /tmp/scratch + - name: rules + mountPath: /rules + {{- end }} ports: - name: http-metrics containerPort: {{ .Values.config.server.http_listen_port }} @@ -98,6 +104,13 @@ spec: {{- toYaml .Values.tolerations | nindent 8 }} terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} volumes: + {{- if gt (len .Values.alerting_groups) 0 }} + - name: scratch + emptyDir: {} + - name: rules + configMap: + name: {{ template "loki.fullname" . }}-alerting-rules + {{- end }} - name: config secret: secretName: {{ template "loki.fullname" . }} @@ -129,4 +142,3 @@ spec: {{- toYaml .Values.persistence.selector | nindent 8 }} {{- end }} {{- end }} - diff --git a/charts/loki/values.yaml b/charts/loki/values.yaml index 05b662366e..ad7618c8b8 100644 --- a/charts/loki/values.yaml +++ b/charts/loki/values.yaml @@ -1,6 +1,6 @@ image: repository: grafana/loki - tag: 1.5.0 + tag: 2.0.0 pullPolicy: IfNotPresent ## Optionally specify an array of imagePullSecrets. @@ -71,18 +71,21 @@ config: reject_old_samples_max_age: 168h schema_config: configs: - - from: 2018-04-15 - store: boltdb + - from: 2020-10-24 + store: boltdb-shipper object_store: filesystem - schema: v9 + schema: v11 index: prefix: index_ - period: 168h + period: 24h server: http_listen_port: 3100 storage_config: - boltdb: - directory: /data/loki/index + boltdb_shipper: + active_index_directory: /data/loki/boltdb-shipper-active + cache_location: /data/loki/boltdb-shipper-cache + cache_ttl: 24h # Can be increased for faster performance over longer query periods, uses more disk space + shared_store: filesystem filesystem: directory: /data/loki/chunks chunk_store_config: @@ -90,6 +93,22 @@ config: table_manager: retention_deletes_enabled: false retention_period: 0s + compactor: + working_directory: /data/loki/boltdb-shipper-compactor + shared_store: filesystem +# Needed for Alerting: https://grafana.com/docs/loki/latest/alerting/ +# This is just a simple example, for more details: https://grafana.com/docs/loki/latest/configuration/#ruler_config +# ruler: +# storage: +# type: local +# local: +# directory: /rules +# rule_path: /tmp/scratch +# alertmanager_url: http://alertmanager.svc.namespace:9093 +# ring: +# kvstore: +# store: inmemory +# enable_api: true ## Additional Loki container arguments, e.g. log level (debug, info, warn, error) extraArgs: {} @@ -122,6 +141,9 @@ persistence: - ReadWriteOnce size: 10Gi annotations: {} + # selector: + # matchLabels: + # app.kubernetes.io/name: loki # subPath: "" # existingClaim: @@ -170,6 +192,7 @@ service: port: 3100 annotations: {} labels: {} + targetPort: http-metrics serviceAccount: create: true @@ -239,3 +262,12 @@ extraPorts: [] # Extra env variables to pass to the loki container env: [] + +# Specify Loki Alerting rules based on this documentation: https://grafana.com/docs/loki/latest/alerting/ +# When specified, you also need to add a ruler config section above. An example is shown in the alerting docs. +alerting_groups: [] +# - name: example +# rules: +# - alert: HighThroughputLogStreams +# expr: sum by(container) (rate({job=~"loki-dev/.*"}[1m])) > 1000 +# for: 2m diff --git a/salt/metalk8s/addons/logging/loki/deployed/chart.sls b/salt/metalk8s/addons/logging/loki/deployed/chart.sls index 0a27596a88..b7ee44332c 100644 --- a/salt/metalk8s/addons/logging/loki/deployed/chart.sls +++ b/salt/metalk8s/addons/logging/loki/deployed/chart.sls @@ -14,7 +14,7 @@ metadata: app.kubernetes.io/managed-by: salt app.kubernetes.io/name: loki app.kubernetes.io/part-of: metalk8s - chart: loki-0.30.2 + chart: loki-2.1.0 heritage: metalk8s release: loki name: loki @@ -59,7 +59,7 @@ metadata: app.kubernetes.io/managed-by: salt app.kubernetes.io/name: loki app.kubernetes.io/part-of: metalk8s - chart: loki-0.30.2 + chart: loki-2.1.0 heritage: metalk8s release: loki name: loki @@ -73,7 +73,7 @@ metadata: app.kubernetes.io/managed-by: salt app.kubernetes.io/name: loki app.kubernetes.io/part-of: metalk8s - chart: loki-0.30.2 + chart: loki-2.1.0 heritage: metalk8s release: loki name: loki @@ -96,7 +96,7 @@ metadata: app.kubernetes.io/managed-by: salt app.kubernetes.io/name: loki app.kubernetes.io/part-of: metalk8s - chart: loki-0.30.2 + chart: loki-2.1.0 heritage: metalk8s release: loki name: loki @@ -117,7 +117,7 @@ metadata: app.kubernetes.io/managed-by: salt app.kubernetes.io/name: loki app.kubernetes.io/part-of: metalk8s - chart: loki-0.30.2 + chart: loki-2.1.0 heritage: metalk8s release: loki variant: headless @@ -143,7 +143,7 @@ metadata: app.kubernetes.io/managed-by: salt app.kubernetes.io/name: loki app.kubernetes.io/part-of: metalk8s - chart: loki-0.30.2 + chart: loki-2.1.0 heritage: metalk8s release: loki name: loki @@ -168,7 +168,7 @@ metadata: app.kubernetes.io/managed-by: salt app.kubernetes.io/name: loki app.kubernetes.io/part-of: metalk8s - chart: loki-0.30.2 + chart: loki-2.1.0 heritage: metalk8s release: loki name: loki @@ -198,7 +198,7 @@ spec: - args: - -config.file=/etc/loki/loki.yaml env: null - image: {% endraw -%}{{ build_image_name("loki", False) }}{%- raw %}:1.5.0 + image: {% endraw -%}{{ build_image_name("loki", False) }}{%- raw %}:2.0.0 imagePullPolicy: IfNotPresent livenessProbe: httpGet: @@ -269,7 +269,7 @@ metadata: app.kubernetes.io/managed-by: salt app.kubernetes.io/name: loki app.kubernetes.io/part-of: metalk8s - chart: loki-0.30.2 + chart: loki-2.1.0 heritage: metalk8s release: prometheus-operator name: loki From 3069601118647dfc06cf82e3e7b9d8862678a9ac Mon Sep 17 00:00:00 2001 From: Teddy Andrieux Date: Thu, 26 Nov 2020 14:57:22 +0100 Subject: [PATCH 5/5] changelog: Add entry about logging stack bump Add an entry in changelog file about bump of fluent-bit and loki charts --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b4b95cb36..f84ff972e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ - Bump `calico` version to 3.17.0 (PR [#2943](https://github.com/scality/metalk8s/pull/2943)) +- Bump `fluent-bit` chart to 2.0.1 and `loki` chart to 2.1.0 + (PR [#2946](https://github.com/scality/metalk8s/pull/2946)) + ### Bug fixes - [#2908](https://github.com/scality/metalk8s/issues/2908) - Make upgrade script