mirror of
https://github.com/amkartashov/gf-k8s.git
synced 2026-01-11 09:59:43 +00:00
logging: replace graylog/fluentbit with loki/promtail
This commit is contained in:
parent
2e89abbd22
commit
4b39c6efd9
8 changed files with 70 additions and 139 deletions
|
|
@ -1 +1,2 @@
|
||||||
name: logging
|
name: logging
|
||||||
|
version: 0.1
|
||||||
|
|
@ -1,13 +1,7 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: graylog
|
- name: loki
|
||||||
version: '1.6.2'
|
version: '0.30.0'
|
||||||
repository: '@stable'
|
repository: https://grafana.github.io/loki/charts
|
||||||
- name: mongodb
|
- name: promtail
|
||||||
version: '7.8.9'
|
version: '0.23.1'
|
||||||
repository: '@stable'
|
repository: https://grafana.github.io/loki/charts
|
||||||
- name: elasticsearch
|
|
||||||
version: '7.6.1'
|
|
||||||
repository: https://helm.elastic.co
|
|
||||||
- name: fluent-bit
|
|
||||||
version: '2.8.11'
|
|
||||||
repository: '@stable'
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
apiVersion: v1
|
|
||||||
kind: PersistentVolume
|
|
||||||
metadata:
|
|
||||||
name: elasticsearch
|
|
||||||
spec:
|
|
||||||
capacity:
|
|
||||||
storage: 30Gi
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteOnce
|
|
||||||
hostPath:
|
|
||||||
path: /data/elasticsearch
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: PersistentVolume
|
kind: PersistentVolume
|
||||||
metadata:
|
metadata:
|
||||||
name: mongodb
|
name: loki
|
||||||
spec:
|
spec:
|
||||||
capacity:
|
capacity:
|
||||||
storage: 1Gi
|
storage: 10Gi
|
||||||
accessModes:
|
accessModes:
|
||||||
- ReadWriteOnce
|
- ReadWriteOnce
|
||||||
hostPath:
|
hostPath:
|
||||||
path: /data/mongodb
|
path: /data/loki
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: PersistentVolumeClaim
|
kind: PersistentVolumeClaim
|
||||||
metadata:
|
metadata:
|
||||||
name: mongodb
|
name: loki
|
||||||
spec:
|
spec:
|
||||||
accessModes:
|
accessModes:
|
||||||
- ReadWriteOnce
|
- ReadWriteOnce
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: 1Gi
|
storage: 10Gi
|
||||||
volumeMode: Filesystem
|
volumeMode: Filesystem
|
||||||
volumeName: mongodb
|
volumeName: loki
|
||||||
|
|
@ -1,112 +1,41 @@
|
||||||
# don't install as graylog deps, because versions are outdated
|
loki:
|
||||||
tags:
|
#extraArgs:
|
||||||
install-elasticsearch: false
|
# log.level: debug
|
||||||
install-mongodb: false
|
nameOverride: loki
|
||||||
|
fullnameOverride: loki
|
||||||
mongodb:
|
serviceAccount:
|
||||||
nameOverride: mongodb
|
create: true
|
||||||
fullnameOverride: mongodb
|
annotations:
|
||||||
usePassword: false
|
iam.gke.io/gcp-service-account: loki-sa@projectid.iam.gserviceaccount.com # will be updated in parameters
|
||||||
|
serviceMonitor:
|
||||||
|
enabled: true
|
||||||
|
interval: 10s
|
||||||
|
scrapeTimeout: 5s
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 150m
|
||||||
|
#memory: 256Mi
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 128Mi
|
||||||
persistence:
|
persistence:
|
||||||
existingClaim: mongodb
|
enabled: true
|
||||||
|
size: 10Gi
|
||||||
elasticsearch:
|
existingClaim: loki
|
||||||
nameOverride: elasticsearch
|
|
||||||
fullnameOverride: elasticsearch
|
|
||||||
imageTag: '6.8.7'
|
|
||||||
replicas: 1
|
|
||||||
minimumMasterNodes: 1
|
|
||||||
volumeClaimTemplate:
|
|
||||||
volumeName: elasticsearch
|
|
||||||
|
|
||||||
fluent-bit:
|
|
||||||
nameOverride: fluent-bit
|
|
||||||
fullnameOverride: fluent-bit
|
|
||||||
image:
|
|
||||||
fluent_bit:
|
|
||||||
tag: 1.4.1
|
|
||||||
input:
|
|
||||||
systemd:
|
|
||||||
enabled: false
|
|
||||||
filter:
|
|
||||||
mergeJSONLog: false
|
|
||||||
trackOffsets: true
|
|
||||||
backend:
|
|
||||||
# no support for gelf in chart, configure manually
|
|
||||||
type: none
|
|
||||||
extraEntries:
|
|
||||||
output: |
|
|
||||||
[OUTPUT]
|
|
||||||
Name gelf
|
|
||||||
Match kube.*
|
|
||||||
Host graylog-udp
|
|
||||||
Port 12201
|
|
||||||
Mode udp
|
|
||||||
Gelf_Short_Message_Key log
|
|
||||||
rawConfig: |
|
|
||||||
@INCLUDE fluent-bit-service.conf
|
|
||||||
@INCLUDE fluent-bit-input.conf
|
|
||||||
@INCLUDE fluent-bit-filter.conf
|
|
||||||
[FILTER]
|
|
||||||
Name nest
|
|
||||||
Match kube.*
|
|
||||||
Operation lift
|
|
||||||
Nested_under kubernetes
|
|
||||||
[FILTER]
|
|
||||||
Name modify
|
|
||||||
Match kube.*
|
|
||||||
Rename container_name container
|
|
||||||
Rename namespace_name namespace
|
|
||||||
Rename pod_name pod
|
|
||||||
[FILTER]
|
|
||||||
Name record_modifier
|
|
||||||
Match kube.*
|
|
||||||
Remove_key time
|
|
||||||
@INCLUDE fluent-bit-output.conf
|
|
||||||
|
|
||||||
graylog:
|
|
||||||
nameOverride: graylog
|
|
||||||
fullnameOverride: graylog
|
|
||||||
graylog:
|
|
||||||
replicas: 1
|
|
||||||
persistence:
|
|
||||||
enabled: false
|
|
||||||
ingress:
|
|
||||||
enabled: true
|
|
||||||
annotations:
|
|
||||||
cert-manager.io/cluster-issuer: letsencrypt
|
|
||||||
nginx.ingress.kubernetes.io/auth-url: https://oauth2.gorilych.ru/oauth2/auth
|
|
||||||
nginx.ingress.kubernetes.io/auth-signin: https://oauth2.gorilych.ru/oauth2/start?rd=$scheme://$host$request_uri
|
|
||||||
nginx.ingress.kubernetes.io/auth-response-headers: X-Forwarded-Email,X-Forwarded-User,X-Roles
|
|
||||||
nginx.ingress.kubernetes.io/configuration-snippet: |
|
|
||||||
auth_request_set $name_upstream_1 $upstream_cookie_name_1;
|
|
||||||
auth_request_set $user $upstream_http_x_auth_request_user;
|
|
||||||
auth_request_set $email $upstream_http_x_auth_request_email;
|
|
||||||
proxy_set_header X-Forwarded-User $user;
|
|
||||||
proxy_set_header X-Forwarded-Email $email;
|
|
||||||
access_by_lua_block {
|
|
||||||
if ngx.var.name_upstream_1 ~= "" then
|
|
||||||
ngx.header["Set-Cookie"] = "name_1=" .. ngx.var.name_upstream_1 .. ngx.var.auth_cookie:match("(; .*)")
|
|
||||||
end
|
|
||||||
}
|
|
||||||
hosts:
|
|
||||||
- graylog.gorilych.ru
|
|
||||||
tls:
|
|
||||||
- hosts:
|
|
||||||
- graylog.gorilych.ru
|
|
||||||
secretName: graylog-tls
|
|
||||||
input:
|
|
||||||
udp:
|
|
||||||
service:
|
|
||||||
type: ClusterIP
|
|
||||||
ports:
|
|
||||||
- name: gelf
|
|
||||||
port: 12201
|
|
||||||
mongodb:
|
|
||||||
uri: mongodb://mongodb:27017/graylog
|
|
||||||
elasticsearch:
|
|
||||||
hosts: http://elasticsearch:9200
|
|
||||||
plugins:
|
|
||||||
- name: graylog-plugin-auth-sso-3.1.0.jar
|
|
||||||
url: https://github.com/Graylog2/graylog-plugin-auth-sso/releases/download/3.1.0/graylog-plugin-auth-sso-3.1.0.jar
|
|
||||||
|
|
||||||
|
promtail:
|
||||||
|
nameOverride: promtail
|
||||||
|
fullnameOverride: promtail
|
||||||
|
serviceMonitor:
|
||||||
|
enabled: true
|
||||||
|
interval: 10s
|
||||||
|
scrapeTimeout: 5s
|
||||||
|
loki:
|
||||||
|
serviceName: loki
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
#memory: 128Mi
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 128Mi
|
||||||
|
|
|
||||||
15
apps/system/monitoring/templates/datasources.yaml
Normal file
15
apps/system/monitoring/templates/datasources.yaml
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: datasources
|
||||||
|
labels:
|
||||||
|
grafana_datasource: "1"
|
||||||
|
data:
|
||||||
|
loki-datasource.yaml: |-
|
||||||
|
apiVersion: 1
|
||||||
|
datasources:
|
||||||
|
- name: Loki
|
||||||
|
type: loki
|
||||||
|
access: proxy
|
||||||
|
url: http://loki.logging:3100
|
||||||
|
version: 1
|
||||||
|
|
@ -88,6 +88,9 @@ prometheus-operator:
|
||||||
gnetId: 9614
|
gnetId: 9614
|
||||||
revision: 1
|
revision: 1
|
||||||
datasource: Prometheus
|
datasource: Prometheus
|
||||||
|
sidecar:
|
||||||
|
datasources:
|
||||||
|
enabled: true
|
||||||
alertmanager:
|
alertmanager:
|
||||||
enabled: false
|
enabled: false
|
||||||
defaultRules:
|
defaultRules:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue