Available in editions:  CE, BE, SE, SE+, EE

The module lifecycle stagePreview

The module has 1 alert.

The module is not enabled by default in any bundles.

How to explicitly enable the module…

You may explicitly enable or disable the module in one of the following ways:

  • Via Deckhouse web UI. In the “System” → “System Management” → “Deckhouse” → “Modules” section, open the loki module and enable (or disable) the “Module enabled” toggle. Save changes.

    Example:

    Module enable/disable interface

  • Via Deckhouse CLI (d8).

    Use the d8 system module enable command for enabling, or d8 system module disable command for disabling the module (you need Deckhouse CLI (d8), configured to work with the cluster).

    Example of enabling the module:

    d8 system module enable loki
    
  • Using ModuleConfig loki.

    Set spec.enabled to true or false in ModuleConfig loki (create it if necessary);

    Example of a manifest to enable module loki:

    apiVersion: deckhouse.io/v1alpha1
    kind: ModuleConfig
    metadata:
      name: loki
    spec:
      enabled: true
    

How to configure the module…

You can configure the module in one of the following ways:

  • Via Deckhouse web UI.

    In the “System” → “System Management” → “Deckhouse” → “Modules” section, open the loki module and enable the “Advanced Settings” switch. Fill in the required fields in the “Configuration” tab or specify the module settings in YAML format on the “YAML” tab, excluding the settings section. Save the changes.

    Example:

    Module Setup Interface

    You can also edit the ModuleConfig object loki on the “YAML” tab in the module settings window (“System” → “System Management” → “Deckhouse” → “Modules”, open the module loki) by specifying the schema version in the spec.version parameter and the necessary module parameters in the spec.settings section.

  • Via Deckhouse CLI (d8) (requires Deckhouse CLI (d8) configured to work with the cluster).

    Edit the existing ModuleConfig loki (for more details on configuring Deckhouse, see the documentation) by executing the following command:

    d8 k edit mc loki
    

    Make the necessary changes in the spec.settings section. If necessary, specify the schema version in the spec.version parameter. Save the changes.

    You can also create a file with manifest for ModuleConfig loki using the example below. Fill in the spec.settings section with the required module parameters. If necessary, specify the schema version in the spec.version parameter.

    Apply the manifest using the following command (indicate the manifest file name):

    d8 k apply -f <FILENAME>
    

    Example of a manifest for ModuleConfig loki:

    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

  • settings
    object
    • settings.allowDeleteLogs
      boolean

      Allow logs deletion using /loki/api/v1/delete endpoints.

      Default: false

    • settings.diskSizeGigabytes
      integer

      Initial 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. The extended-monitoring module automatically monitors the percentage of used disk space.

      Default: 2

    • settings.lokiConfig
      object

      Loki configuration options available for tuning.

      See Loki documentation for more information.

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

      • settings.lokiConfig.grpcServerMaxConcurrentStreams
        integer

        Limit on the number of concurrent streams for gRPC calls.

        Default: 100

      • settings.lokiConfig.grpcServerMaxRecvMsgSize
        integer

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

        Default: 104857600

      • settings.lokiConfig.grpcServerMaxSendMsgSize
        integer

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

        Default: 4194304

      • settings.lokiConfig.ingestionBurstSizeMB
        number

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

        Default: 6

      • settings.lokiConfig.ingestionRateMB
        number

        Overall ingestion rate limit in megabytes per second.

        Default: 4

      • settings.lokiConfig.maxChunksPerQuery
        integer

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

        Default: 2000000

      • settings.lokiConfig.maxEntriesLimitPerQuery
        integer

        The maximum number of entries returned for the query.

        Default: 5000

      • settings.lokiConfig.maxLabelNamesPerSeries
        integer

        The maximum number of unique label names per series (log stream).

        Default: 32

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

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

      • settings.lokiConfig.perStreamRateLimitBurst

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

        Default: 15MB

    • settings.nodeSelector
      object

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

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

      • settings.resourcesManagement.static
        object

        Resource management options for the Static mode.

        • settings.resourcesManagement.static.limits
          object

          Configuring CPU and memory limits.

          • settings.resourcesManagement.static.limits.cpu

            Configuring CPU limits.

          • settings.resourcesManagement.static.limits.memory

            Configuring memory limits.

        • settings.resourcesManagement.static.requests
          object

          Resource requests settings for pods.

          • settings.resourcesManagement.static.requests.cpu

            Configuring CPU requests.

          • settings.resourcesManagement.static.requests.memory

            Configuring memory requests.

      • settings.resourcesManagement.vpa
        object

        Resource management options for the VPA mode.

        • settings.resourcesManagement.vpa.cpu
          object

          CPU-related VPA settings.

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

          • settings.resourcesManagement.vpa.cpu.max

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

            Default: 2

          • settings.resourcesManagement.vpa.cpu.min

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

            Default: 50m

        • settings.resourcesManagement.vpa.memory
          object

          Memory-related VPA settings.

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

          • settings.resourcesManagement.vpa.memory.max

            The maximum memory requests the VPA can set.

            Default: 2Gi

          • settings.resourcesManagement.vpa.memory.min

            The minimum memory requests the VPA can set.

            Default: 256Mi

        • settings.resourcesManagement.vpa.mode
          string

          VPA operating mode.

          Default: Auto

          Allowed values: Initial, Auto

    • settings.retentionPeriodHours
      integer

      The desired minimum log retention period in hours.

      This parameter does not affect the log retention depth, since Loki only deletes old data when the disk is full.

      If Loki deletes data that has not yet reached the specified retention period, you will receive a LokiInsufficientDiskForRetention alert. In this case, you should either increase the disk size or decrease the value of this parameter.

      Default: 168

    • settings.storageClass

      The name of StorageClass that will be used in the cluster by default.

      If omitted, the StorageClass of the existing Loki PVC is used. If there is no PVC yet, the StorageClass will be used according to the global storageClass parameter setting.

      The global storageClass parameter is only considered when the module is enabled. Changing the global storageClass parameter while the module is enabled will not trigger disk re-provisioning.

      Warning. Specifying a value different from the one currently used (in the existing PVC) will result in disk re-provisioning and all data will be deleted.

      Examples:

      storageClass: false
      
      storageClass: default
      
    • settings.storeSystemLogs
      boolean

      Save logs from the d8-* namespaces to loki.

      The log-shipper module must be enabled.

      Default: true

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

      • settings.tolerations.effect
        string
      • settings.tolerations.key
        string
      • settings.tolerations.operator
        string
      • settings.tolerations.tolerationSeconds
        integer
      • settings.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