Added Loki.

This commit is contained in:
Joseph Hanson 2024-02-29 11:09:02 -06:00
parent 68738a9a1a
commit 2087fa8688
5 changed files with 240 additions and 1 deletions

View file

@ -9,7 +9,7 @@ resources:
# - ./gatus/ks.yaml
# - ./grafana/ks.yaml
- ./kube-prometheus-stack/ks.yaml
# - ./loki/ks.yaml
- ./loki/ks.yaml
# - ./smartctl-exporter/ks.yaml
# - ./snmp-exporter/ks.yaml
- ./thanos/ks.yaml

View file

@ -0,0 +1,194 @@
---
# yaml-language-server: $schema=https://ks.hsn.dev/helm.toolkit.fluxcd.io/helmrelease_v2beta2.json
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
name: loki
spec:
interval: 30m
timeout: 15m
chart:
spec:
chart: loki
version: 5.43.3
sourceRef:
kind: HelmRepository
name: grafana
namespace: flux-system
install:
remediation:
retries: 3
upgrade:
cleanupOnFail: true
remediation:
retries: 3
uninstall:
keepHistory: false
dependsOn:
- name: openebs
namespace: openebs-system
- name: rook-ceph-cluster
namespace: rook-ceph
- name: vector-agent
namespace: observability
- name: vector-aggregator
namespace: observability
valuesFrom:
- targetPath: loki.structuredConfig.common.storage.s3.bucketnames
kind: ConfigMap
name: loki-bucket-v2
valuesKey: BUCKET_NAME
- targetPath: loki.structuredConfig.common.storage.s3.endpoint
kind: ConfigMap
name: loki-bucket-v2
valuesKey: BUCKET_HOST
- targetPath: loki.structuredConfig.common.storage.s3.access_key_id
kind: Secret
name: loki-bucket-v2
valuesKey: AWS_ACCESS_KEY_ID
- targetPath: loki.structuredConfig.common.storage.s3.secret_access_key
kind: Secret
name: loki-bucket-v2
valuesKey: AWS_SECRET_ACCESS_KEY
values:
loki:
structuredConfig:
auth_enabled: false
server:
log_level: info
http_listen_port: 3100
grpc_listen_port: 9095
memberlist:
join_members: ["loki-memberlist"]
limits_config:
retention_period: 14d
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 168h
max_cache_freshness_per_query: 10m
split_queries_by_interval: 1h
max_query_parallelism: 100
ingestion_rate_mb: 50
ingestion_burst_size_mb: 1000
per_stream_rate_limit: 5MB
per_stream_rate_limit_burst: 20MB
shard_streams:
enabled: true
query_scheduler:
max_outstanding_requests_per_tenant: 4096
frontend:
max_outstanding_per_tenant: 4096
schema_config:
configs:
- from: "2022-01-11" # quote
store: boltdb-shipper
object_store: s3
schema: v12
index:
prefix: loki_index_
period: 24h
common:
path_prefix: /var/loki
replication_factor: 2
storage:
s3:
s3: null
insecure: true
s3forcepathstyle: true
ring:
kvstore:
store: memberlist
ruler:
enable_api: true
enable_alertmanager_v2: true
alertmanager_url: http://alertmanager-operated.observability.svc.cluster.local:9093
storage:
type: local
local:
directory: /rules
rule_path: /tmp/scratch
ring:
kvstore:
store: memberlist
distributor:
ring:
kvstore:
store: memberlist
compactor:
working_directory: /var/loki/boltdb-shipper-compactor
shared_store: s3
compaction_interval: 10m
retention_enabled: true
retention_delete_delay: 2h
retention_delete_worker_count: 150
ingester:
max_chunk_age: 1h
lifecycler:
ring:
kvstore:
store: memberlist
analytics:
reporting_enabled: false
gateway:
replicas: 2
image:
registry: ghcr.io
ingress:
enabled: true
ingressClassName: internal
hosts:
- host: &host loki.devbu.io
paths:
- path: /
pathType: Prefix
tls:
- hosts:
- *host
read:
replicas: 2
persistence:
storageClass: openebs-hostpath
extraVolumeMounts:
- name: rules
mountPath: /rules
extraVolumes:
- name: rules
emptyDir: {}
write:
replicas: 2
persistence:
storageClass: openebs-hostpath
backend:
replicas: 2
persistence:
storageClass: openebs-hostpath
extraVolumeMounts:
- name: rules
mountPath: /rules/fake
- name: scratch
mountPath: /tmp/scratch
extraVolumes:
- name: rules
configMap:
name: loki-alerting-rules
- name: scratch
emptyDir: {}
monitoring:
dashboards:
annotations:
grafana_folder: Loki
serviceMonitor:
enabled: false
metricsInstance:
enabled: false
selfMonitoring:
enabled: false
grafanaAgent:
installOperator: false
lokiCanary:
enabled: false
sidecar:
image:
repository: ghcr.io/kiwigrid/k8s-sidecar
test:
enabled: false

View file

@ -0,0 +1,13 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./objectbucketclaim.yaml
- ./helmrelease.yaml
configMapGenerator:
- name: loki-alerting-rules
files:
- loki-alerting-rules.yaml=./rules/loki-alerting-rules.yaml
generatorOptions:
disableNameSuffixHash: true

View file

@ -0,0 +1,9 @@
---
# yaml-language-server: $schema=https://ks.hsn.dev/objectbucket.io/objectbucketclaim_v1alpha1.json
apiVersion: objectbucket.io/v1alpha1
kind: ObjectBucketClaim
metadata:
name: loki-bucket-v2
spec:
bucketName: loki-v2
storageClassName: ceph-bucket

View file

@ -0,0 +1,23 @@
---
# yaml-language-server: $schema=https://ks.hsn.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &app loki
namespace: flux-system
spec:
targetNamespace: observability
commonMetadata:
labels:
app.kubernetes.io/name: *app
dependsOn:
- name: external-secrets-stores
path: ./kubernetes/apps/observability/loki/app
prune: true
sourceRef:
kind: GitRepository
name: homelab
wait: false
interval: 30m
retryInterval: 1m
timeout: 15m