Skip to content

Instantly share code, notes, and snippets.

@ralvares
Last active October 17, 2025 12:24
Show Gist options
  • Select an option

  • Save ralvares/02ea07b5ce607ddcea24f9152687e367 to your computer and use it in GitHub Desktop.

Select an option

Save ralvares/02ea07b5ce607ddcea24f9152687e367 to your computer and use it in GitHub Desktop.
oc create sa loki-sa -n netobserv
#DONT DO THIS### TESTING ONLY
oc adm policy add-scc-to-user privileged -z loki-sa -n netobserv
####
####
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: loki-store
spec:
resources:
requests:
storage: 10G
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: loki-sa
---
apiVersion: v1
kind: ConfigMap
metadata:
name: loki-config
data:
local-config.yaml: |
auth_enabled: false
server:
http_listen_port: 3100
grpc_listen_port: 9096
grpc_server_max_recv_msg_size: 10485760
http_server_read_timeout: 1m
http_server_write_timeout: 1m
log_level: error
target: all
common:
path_prefix: /loki-store
storage:
filesystem:
chunks_directory: /loki-store/chunks
rules_directory: /loki-store/rules
replication_factor: 1
ring:
instance_addr: 127.0.0.1
kvstore:
store: inmemory
compactor:
compaction_interval: 5m
retention_enabled: true
retention_delete_delay: 2h
retention_delete_worker_count: 150
frontend:
compress_responses: true
ingester:
chunk_encoding: snappy
chunk_retain_period: 1m
query_range:
align_queries_with_step: true
cache_results: true
max_retries: 5
results_cache:
cache:
enable_fifocache: true
fifocache:
max_size_bytes: 500MB
validity: 24h
parallelise_shardable_queries: true
query_scheduler:
max_outstanding_requests_per_tenant: 2048
schema_config:
configs:
- from: 2022-01-01
store: boltdb-shipper
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h
storage_config:
filesystem:
directory: /loki-store/storage
boltdb_shipper:
active_index_directory: /loki-store/index
shared_store: filesystem
cache_location: /loki-store/boltdb-cache
cache_ttl: 24h
limits_config:
ingestion_rate_strategy: global
ingestion_rate_mb: 10
ingestion_burst_size_mb: 10
max_label_name_length: 1024
max_label_value_length: 2048
max_label_names_per_series: 30
reject_old_samples: true
reject_old_samples_max_age: 15m
creation_grace_period: 10m
enforce_metric_name: false
max_line_size: 256000
max_line_size_truncate: false
max_entries_limit_per_query: 10000
max_streams_per_user: 0
max_global_streams_per_user: 0
unordered_writes: true
max_chunks_per_query: 2000000
max_query_length: 721h
max_query_parallelism: 32
max_query_series: 10000
cardinality_limit: 100000
max_streams_matchers_per_query: 1000
max_concurrent_tail_requests: 10
retention_period: 24h
max_cache_freshness_per_query: 5m
max_queriers_per_tenant: 0
per_stream_rate_limit: 3MB
per_stream_rate_limit_burst: 15MB
max_query_lookback: 0
min_sharding_lookback: 0s
split_queries_by_interval: 1m
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: loki
labels:
app: loki
spec:
replicas: 1
selector:
matchLabels:
app: loki
template:
metadata:
labels:
app: loki
spec:
serviceAccountName: loki-sa
securityContext:
runAsGroup: 1000
runAsUser: 1000
fsGroup: 1000
volumes:
- name: loki-store
persistentVolumeClaim:
claimName: loki-store
- name: loki-config
configMap:
name: loki-config
containers:
- name: loki
image: grafana/loki:2.9.0
args:
- "-config.file=/etc/loki/local-config.yaml"
ports:
- containerPort: 3100
volumeMounts:
- mountPath: "/loki-store"
name: loki-store
- mountPath: "/etc/loki"
name: loki-config
securityContext:
seccompProfile:
type: RuntimeDefault
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readinessProbe:
httpGet:
path: /ready
port: 3100
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
httpGet:
path: /ready
port: 3100
initialDelaySeconds: 15
periodSeconds: 20
---
apiVersion: v1
kind: Service
metadata:
name: loki
spec:
selector:
app: loki
ports:
- port: 3100
targetPort: 3100
protocol: TCP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment