PLG Setup

Loki

helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
  1. Declare the values.yaml

(File system - Single Binary)
deploymentMode: SingleBinary
loki:
   commonConfig:
     replication_factor: 1
   schemaConfig:
     configs:
       - from: "2024-04-01"
         store: tsdb
         object_store: filesystem
         schema: v13
         index:
           prefix: loki_index_
           period: 24h
   storage:
      type: filesystem
      filesystem:
        admin_api_directory: "/var/loki/admin"
        chunks_directory: "/var/loki/chunks"
        rules_directory: "/var/loki/rules"
   ingester:
     chunk_encoding: snappy
   querier:
     # Default is 4, if you have enough memory and CPU you can increase, reduce if OOMing
     max_concurrent: 4
   pattern_ingester:
     enabled: true
   limits_config:
     allow_structured_metadata: true
     volume_enabled: true
   auth_enabled: false
# Zero out replica counts of other deployment modes
backend:
  replicas: 0
read:
  replicas: 0
write:
  replicas: 0

ingester:
  replicas: 0
querier:
  replicas: 0
queryFrontend:
  replicas: 0
queryScheduler:
  replicas: 0
distributor:
  replicas: 0
compactor:
  replicas: 0
indexGateway:
  replicas: 0
bloomCompactor:
  replicas: 0
bloomGateway:
  replicas: 0

singleBinary:
   replicas: 1
   persistence:
    enabled: true
    size: "20Gi"
    storageClass: "alicloud-disk-essd" # Specify your storage class here
    accessModes:
      - ReadWriteOnce
   annotations:
      volume.beta.kubernetes.io/storage-provisioner: diskplugin.csi.alibabacloud.com
  1. Apply the setting and deploy to k8s via helm

  1. Make sure all the pods and volume are available

Grafana

  1. Declare the values.yaml

  1. Apply the setting and deploy

  1. Set up the Loki data source (Connect to your deployed loki gateway)

  1. Test the logging by posting the message to loki gateway, make sure that the timestamp is updated

Promtail

  1. Create config-map.yaml

  1. Create deployment.yaml

  1. Create service.yaml

  1. Apply the application

Alloy

  1. Create config-map.yaml

  • Declare deployment.yaml

  • If wanna debug alloy for the flow, port forward to port 12345 , access localhost:12345/graph

References

Last updated