The module is not enabled by default in any bundles.

How to explicitly enable the module…

Set the spec.enabled module parameter to true or false in the ModuleConfig/loki resource (create it, if necessary) to explicitly enable or disable the module, or use the deckhouse-controller module command in the d8-system/deckhouse pod.

Example of enabling the module:

  • by using the ModuleConfig resource:

    apiVersion: deckhouse.io/v1alpha1
    kind: ModuleConfig
    metadata:
      name: loki
    spec:
      enabled: true
    
  • by using the deckhouse-controller command (you need a kubectl, configured to work with the cluster):

    kubectl -ti -n d8-system exec svc/deckhouse-leader -c deckhouse -- deckhouse-controller module enable loki
    

Example of disabling the module:

  • by using the ModuleConfig resource:

    apiVersion: deckhouse.io/v1alpha1
    kind: ModuleConfig
    metadata:
      name: loki
    spec:
      enabled: false
    
  • by using the deckhouse-controller command (you need a kubectl, configured to work with the cluster):

    kubectl -ti -n d8-system exec svc/deckhouse-leader -c deckhouse -- deckhouse-controller module disable loki
    

The module is configured using the ModuleConfig custom resource named loki (learn more about setting up Deckhouse…).

Example of the ModuleConfig/loki resource for configuring the module:

apiVersion: deckhouse.io/v1alpha1
kind: ModuleConfig
metadata:
  name: loki
spec:
  version: 1
  enabled: true
  settings: # <-- Module parameters from the "Parameters" section below.

Parameters

Schema version: 1

  • diskSizeGigabytes
    integer

    Disk size for log storage or PVC size when specifying the storageClass parameters. You should manually specify the required disk size for storing logs for the period defined by the retentionPeriodHours parameter. Loki cannot automatically delete old data when the disk is full. The extended-monitoring module automatically monitors the percentage of used disk space. CAUTION! If the Loki data disk becomes full, the application will stop working. You must find the right balance between retentionPeriodHours and diskSizeGigabytes values.

    Default: 2

  • lokiConfig
    object

    Loki configuration options available for tuning.

    See Loki documentation for more information.

    Caution! Incorrect settings may lead to the malfunction of Loki.

    • lokiConfig.grpcServerMaxConcurrentStreams
      integer

      Limit on the number of concurrent streams for gRPC calls.

      Default: 100

    • lokiConfig.grpcServerMaxRecvMsgSize
      integer

      Limit on the size of a gRPC message this server can receive in bytes.

      Default: 104857600

    • lokiConfig.grpcServerMaxSendMsgSize
      integer

      Limit on the size of a gRPC message this server can send in bytes.

      Default: 4194304

    • lokiConfig.ingestionBurstSizeMB
      number

      Overall ingestion burst size in megabytes. E.g., maximum push request size.

      Default: 6

    • lokiConfig.ingestionRateMB
      number

      Overall ingestion rate limit in megabytes per second.

      Default: 4

    • lokiConfig.maxChunksPerQuery
      integer

      The maximum number of chunks that can be fetched per query.

      Default: 2000000

    • lokiConfig.maxEntriesLimitPerQuery
      integer

      The maximum number of entries returned for the query.

      Default: 5000

    • lokiConfig.maxStreamsPerUser
      integer

      The maximum total number of streams for the Loki instance.

      Each stream has unique labels. The number of streams is the number of unique label sets. E. g. {job="my-app", instance="kube-node-1", namespace="production", pod_name="backend-79dbf6fcb7-v5gs7", app="backend"}.

      0 means unlimited.

      Default: 0

    • lokiConfig.perStreamRateLimit

      Maximum byte rate per second per stream. Can be either a number or a string with a unit (KB, MB, GB).

      Default: 3MB

    • lokiConfig.perStreamRateLimitBurst

      Maximum burst size per stream. Can be either a number or a string with a unit (KB, MB, GB).

      Default: 15MB

  • nodeSelector
    object

    The same as the Pods’ spec.nodeSelector parameter in Kubernetes. If the parameter is omitted or false, nodeSelector will be determined automatically.

  • resourcesManagement

    Settings for CPU and memory requests and limits by Loki pods.

    Examples:

    resourcesManagement:
      mode: VPA
      vpa:
        mode: Auto
        cpu:
          min: 50m
          max: 2
          limitRatio: 1.5
        memory:
          min: 256Mi
          max: 2Gi
          limitRatio: 1.5
    
    resourcesManagement:
      mode: Static
      static:
        requests:
          cpu: 55m
          memory: 256Mi
        limits:
          cpu: 2
          memory: 2Gi
    
    • resourcesManagement.mode
      string

      Resource management mode:

      • Static is a classic one. In it, you specify requests/limits. The parameters of this mode are defined in the static parameter section;
      • VPA mode uses VPA. You can configure this mode by modifying parameters in the vpa parameter section.

      Default: "VPA"

      Allowed values: VPA, Static

    • resourcesManagement.static
      object

      Resource management options for the Static mode.

      • resourcesManagement.static.limits
        object

        Configuring CPU and memory limits.

        • resourcesManagement.static.limits.cpu

          Configuring CPU limits.

        • resourcesManagement.static.limits.memory

          Configuring memory limits.

      • resourcesManagement.static.requests
        object

        Resource requests settings for pods.

        • resourcesManagement.static.requests.cpu

          Configuring CPU requests.

        • resourcesManagement.static.requests.memory

          Configuring memory requests.

    • resourcesManagement.vpa
      object

      Resource management options for the VPA mode.

      • resourcesManagement.vpa.cpu
        object

        CPU-related VPA settings.

        • resourcesManagement.vpa.cpu.limitRatio
          number

          The CPU limits/requests ratio.

          This ratio is used for calculating the initial CPU limits for a pod.

          If this parameter is set, the VPA will recalculate the CPU limits while maintaining the specified limits/requests ratio.

        • resourcesManagement.vpa.cpu.max

          The maximum value that the VPA can set for the CPU requests.

          Default: 2

        • resourcesManagement.vpa.cpu.min

          The minimum value that the VPA can set for the CPU requests.

          Default: 50m

      • resourcesManagement.vpa.memory
        object

        Memory-related VPA settings.

        • resourcesManagement.vpa.memory.limitRatio
          number

          The memory limits/requests ratio.

          This ratio is used for calculating the initial memory limits for a pod.

          If this parameter is set, the VPA will recalculate the memory limits while maintaining the specified limits/requests ratio.

        • resourcesManagement.vpa.memory.max

          The maximum memory requests the VPA can set.

          Default: 2Gi

        • resourcesManagement.vpa.memory.min

          The minimum memory requests the VPA can set.

          Default: 256Mi

      • resourcesManagement.vpa.mode
        string

        VPA operating mode.

        Default: "Auto"

        Allowed values: Initial, Auto

  • retentionPeriodHours
    integer

    How many hours to keep logs before deleting.

    Default: 168

  • storageClass

    The name of the StorageClass to use.

    If omitted, the StorageClass of the existing Loki PVC is used. If there is no PVC yet, either the global StorageClass or global.discovery.defaultStorageClass is used, and if those are undefined, the emptyDir volume is used to store the data.

    storageClass: false — forces the emptyDir usage. You will need to delete the old PVC and restart the Pod manually.

    global.discovery.defaultStorageClass is applied during module activation, changing default StorageClass in cluster won’t result in disk re-provisioning.

    CAUTION! Setting a value other than the current one (in the existing PVC) will cause the Loki volume to be re-provisioned and the data to be lost.

    Examples:

    storageClass: false
    
    storageClass: default
    
  • storeSystemLogs
    boolean

    Save logs from the d8-* namespaces to loki.

    The log-shipper module must be enabled.

    Default: true

  • tolerations
    array of objects

    The same as the Pods’ spec.tolerations parameter in Kubernetes. If the parameter is omitted or false, tolerations will be determined automatically.

    • tolerations.effect
      string
    • tolerations.key
      string
    • tolerations.operator
      string
    • tolerations.tolerationSeconds
      integer
    • tolerations.value
      string

An example of the configuration

apiVersion: deckhouse.io/v1alpha1
kind: ModuleConfig
metadata:
  name: loki
spec:
  settings:
    storageClass: ceph-csi-rbd
    diskSizeGigabytes: 10
    retentionPeriodHours: 48
  enabled: true
  version: 1