This feature is actively developed. It might significantly change in the future.

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 deploy/deckhouse -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 deploy/deckhouse -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

  • diskSizeGigabytesinteger

    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

  • nodeSelectorobject

    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.modestring

      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.staticobject

      Resource management options for the Static mode.

      • resourcesManagement.static.limitsobject

        Configuring CPU and memory limits.

        • resourcesManagement.static.limits.cpu

          Configuring CPU limits.

        • resourcesManagement.static.limits.memory

          Configuring memory limits.

      • resourcesManagement.static.requestsobject

        Resource requests settings for pods.

        • resourcesManagement.static.requests.cpu

          Configuring CPU requests.

        • resourcesManagement.static.requests.memory

          Configuring memory requests.

    • resourcesManagement.vpaobject

      Resource management options for the VPA mode.

      • resourcesManagement.vpa.cpuobject

        CPU-related VPA settings.

        • resourcesManagement.vpa.cpu.limitRationumber

          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.memoryobject

        Memory-related VPA settings.

        • resourcesManagement.vpa.memory.limitRationumber

          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.modestring

        VPA operating mode.

        Default: "Auto"

        Allowed values: Initial, Auto

  • retentionPeriodHoursinteger

    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. 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
    
  • storeSystemLogsboolean

    Save logs from the d8-* namespaces to loki.

    The log-shipper module must be enabled.

    Default: true

  • tolerationsarray 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.effectstring
    • tolerations.keystring
    • tolerations.operatorstring
    • tolerations.tolerationSecondsinteger
    • tolerations.valuestring

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