Setting Limits for CPU & Memory that will be consumed by LokiStack pods in RHOCP4

Solution Verified - Updated

Environment

  • Red Hat OpenShift Container Platform (RHOCP)
    • 4
  • Red Hat OpenShift Logging (RHOL)
    • 5
    • 6
  • Red Hat Loki Operator
  • LokiStack

Issue

  • Is it possible to Limits for CPU & Memory for the LokiStack pods
  • How to set the resource limits in the Loki pods?

Resolution

Red Hat is aware of this feature request in RFE This content is not included.OBSDA-738.

In Logging 6.3.0 was released as Technology Preview the feature that allows to enable the resource limits to be equal to the resource requests for the Loki pods. This imposes a hard limit on resource usage of the LokiStack, but limits its ability to react to load spikes, whether on the ingestion or query side.

Read the Red Hat Knowledge Article "Technology Preview Features - Scope of Support" for knowing more about the meaning of Technology Preview.

How to enable the Technology Preview feature in not production environments

  1. Define the variables:
cr="logging-loki"
ns="openshift-logging"
  1. Enable the feature:
$ oc -n $ns patch lokistack/$cr --type=merge -p '{"spec": {"template": {"useRequestsAsLimits": true}}}'
  1. The Loki Operator should rollout the Loki pods with the resources limits equal to the resources requests. Let's verify it:
$ oc get pod logging-loki-ingester-1 -o yaml |egrep "requests|limits" -A 2
      limits:
        cpu: "2"
        memory: 8Gi
      requests:
        cpu: "2"
        memory: 8Gi

If this feature is required, open a support case on the Red Hat Customer Portal referring to this solution.

Root Cause

The limits.memory and limits.cpu are not set by default in any of the LokiStack components and it's not exposed the variables for being set through the Loki Operator.

Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.