Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 1. Scheduling logging resources
You can schedule logging resources by defining node selectors, taints and tolerations, and affinity and anti-affinity configurations.
- Node selector
- A node selector specifies a map of key-value pairs that are defined using custom labels on nodes and selectors specified in pods. For the pod to be eligible to run on a node, the pod must have the same key-value pair as the label on the node.
- Taints and toleration
- Taints and tolerations control which pods should, or should not, be scheduled on nodes.
- Affinity and anti-affinity
- Pod affinity and pod anti-affinity allow you to constrain which nodes your pod is eligible to be scheduled on based on the key-value labels on other pods.
If you configure both nodeSelector
and `nodeAffinity`fields, the conditions of both fields must be met for the pod to be scheduled onto a candidate node.
1.1. Using tolerations to control log collector pod placement Link kopierenLink in die Zwischenablage kopiert!
By default, log collector pods have the following tolerations
configuration:
Prerequisites
-
You have installed the Red Hat OpenShift Logging Operator and OpenShift CLI (
oc
).
Procedure
Add a taint to a node where you want logging collector pods to schedule logging collector pods by running the following command:
oc adm taint nodes <node_name> <key>=<value>:<effect>
$ oc adm taint nodes <node_name> <key>=<value>:<effect>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example command
oc adm taint nodes node1 collector=node:NoExecute
$ oc adm taint nodes node1 collector=node:NoExecute
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This example places a taint on
node1
that has keycollector
, valuenode
, and taint effectNoExecute
. You must use theNoExecute
taint effect.NoExecute
schedules only pods that match the taint and removes existing pods that do not match.Edit the
collection
stanza of theClusterLogging
custom resource (CR) to configure a toleration for the logging collector pods:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
This toleration matches the taint created by the oc adm taint
command. A pod with this toleration can be scheduled onto node1
.
1.2. Configuring resources and scheduling for logging collectors Link kopierenLink in die Zwischenablage kopiert!
Administrators can modify the resources and scheduling of the collector by configuring the collector
field in a ClusterLogForwarder
custom resource (CR).
Prerequisites
- You have administrator permissions.
- You have installed Red Hat OpenShift Logging Operator.
-
You have created a
ClusterLogForwarder
CR.
Procedure
Update the
ClusterLogForwarder
CR:Example
ClusterLogForwarder
CR YAMLCopy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the
ClusterLogForwarder
CR by running the following command:oc apply -f <filename>.yaml
$ oc apply -f <filename>.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.3. Viewing logging collector pods Link kopierenLink in die Zwischenablage kopiert!
You can view the logging collector pods and the corresponding nodes that they are running on.
Procedure
Run the following command in a project to view the logging collector pods and their details:
oc get pods --selector component=collector -o wide -n <project_name>
$ oc get pods --selector component=collector -o wide -n <project_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.4. Loki pod placement Link kopierenLink in die Zwischenablage kopiert!
You can control which nodes the Loki pods run on, and prevent other workloads from using those nodes, by using tolerations or node selectors on the pods.
You can apply tolerations to the log store pods with the LokiStack custom resource (CR) and apply taints to a node with the node specification. A taint on a node is a key:value
pair that instructs the node to repel all pods that do not allow the taint. Using a specific key:value
pair that is not on other pods ensures that only the log store pods can run on that node.
Example LokiStack with node selectors
In the previous example configuration, all Loki pods are moved to nodes containing the node-role.kubernetes.io/infra: ""
label.
Example LokiStack CR with node selectors and tolerations
To configure the nodeSelector
and tolerations
fields of the LokiStack (CR), you can use the oc explain
command to view the description and fields for a particular resource:
oc explain lokistack.spec.template
$ oc explain lokistack.spec.template
Example output
For more detailed information, you can add a specific field:
oc explain lokistack.spec.template.compactor
$ oc explain lokistack.spec.template.compactor
Example output