98 lines
2.1 KiB
YAML
98 lines
2.1 KiB
YAML
# --- Configuration ---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: loki-config
|
|
namespace: monitoring
|
|
data:
|
|
local-config.yaml: |
|
|
auth_enabled: false
|
|
server:
|
|
http_listen_port: 3100
|
|
common:
|
|
path_prefix: /loki
|
|
storage:
|
|
filesystem:
|
|
chunks_directory: /loki/chunks
|
|
rules_directory: /loki/rules
|
|
replication_factor: 1
|
|
ring:
|
|
instance_addr: 127.0.0.1
|
|
kvstore:
|
|
store: inmemory
|
|
schema_config:
|
|
configs:
|
|
- from: 2020-10-24
|
|
store: tsdb
|
|
object_store: filesystem
|
|
schema: v13
|
|
index:
|
|
prefix: index_
|
|
period: 24h
|
|
limits_config:
|
|
allow_structured_metadata: true
|
|
|
|
---
|
|
# --- Storage Service (Headless) ---
|
|
# Required for StatefulSets to maintain stable DNS entries.
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: loki
|
|
namespace: monitoring
|
|
spec:
|
|
type: ClusterIP
|
|
selector:
|
|
app: loki
|
|
ports:
|
|
- port: 3100
|
|
targetPort: 3100
|
|
name: http-metrics
|
|
|
|
---
|
|
# --- The Database (StatefulSet) ---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: loki
|
|
namespace: monitoring
|
|
spec:
|
|
serviceName: loki
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: loki
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: loki
|
|
spec:
|
|
# securityContext:
|
|
# fsGroup: 10001 # Often needed for Loki write permissions
|
|
containers:
|
|
- name: loki
|
|
image: grafana/loki:latest
|
|
args:
|
|
- -config.file=/etc/loki/local-config.yaml
|
|
ports:
|
|
- containerPort: 3100
|
|
name: http-metrics
|
|
volumeMounts:
|
|
- name: config
|
|
mountPath: /etc/loki
|
|
- name: data
|
|
mountPath: /loki
|
|
volumes:
|
|
- name: config
|
|
configMap:
|
|
name: loki-config
|
|
# Persistent Storage: Automatically creates a Volume for data retention
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: data
|
|
spec:
|
|
accessModes: [ "ReadWriteOnce" ]
|
|
resources:
|
|
requests:
|
|
storage: 5Gi
|