How to configure collector resources for Multi Log Forwarder feature in RHOCP 4
Environment
- Red Hat OpenShift Container Platform (RHOCP)
- 4
- Red Hat Openshift Logging (RHOL)
- 5.8 and newer versions
- Vector
- Multi Cluster Log Forwarder
Issue
- How to define resources in collector pods for the Multi Log Forwarder feature?
- How to define tolerations in collector pods for the Multi Log Forwarder feature?
- Not able to configure resources, limits, and requests in the collector configuration for the Multi Log Forwarder feature.
Resolution
Create a ClusterLogging custom resource (CR) instance in the same project that the ClusterLogForwarder (CLF) resource exists. The ClusterLogging CR should have the exact same name as the ClusterLogForwarder CR.
In the example below the name of the instance is mycollection and it is deployed in the mylogging namespace:
$ oc edit ClusterLogging instance -n mylogging
apiVersion: logging.openshift.io/v1
kind: ClusterLogging
metadata:
name: mycollection
namespace: mylogging
spec:
collection:
type: vector
resources:
limits:
cpu: <cpu_limits>
memory: <memory_limits>
requests:
cpu: <cpu_requests>
memory: <memory_requests>
tolerations:
- effect: NoExecute
key: node-role.kubernetes.io/infra
operator: Equal
value: reserved
[...]
Root Cause
When it's created a clusterLogForwarder CR in a namespace not being the openshift-logging the collector pods are started with the default values for the resources, tolerations and nodeSelector.
For setting different values for the resources, tolerations and nodeSelector a clusterLogging CR should be created.
Documentation bug This content is not included.OBSDOCS-726 was created to update how to configure the collector for the Multi Log Forwarder feature when needed different values of resources, tolerations and/or nodeSelector.
Diagnostic Steps
In the following steps, the name of the instance is mycollection and it is deployed in mylogging project as in the example above:
Check if the custom values of the collector resources are defined in ClusterLogging (CR) instance:
$ oc get clusterlogging mycollection -n mylogging -o jsonpath='{.spec.collection.resources}'
Check if the correct values of the resources are defined in the collector pod configuration:
$ oc get pod <collector_pod> -n mylogging -o jsonpath='{.spec.containers[?(@.name=="collector")].resources}'
Check if the collector tolerations are defined in ClusterLogging custom resource (CR) instance:
$ oc get clusterlogging mycollection -n mylogging -o jsonpath='{.spec.collection.tolerations}'
Check if the correct tolerations are defined in the collector pod configuration:
$ oc get pod <collector_pod> -n mylogging -o jsonpath='{.spec.tolerations}'
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.