mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-05-05 20:53:33 +00:00
c869ea69ac
* Fix 'title out of sequence' errors fixed Dockershim.md * fixed deprecated-features.md * fixed install-and-configure-kubectl.md * fixed rancher-is-no-longer-needed.md * fixed security.md * fixed technical-items.md + spacing, duplicate section, admonitions * fixed telemetry.md * fixed upgrades.md * fixed upgrade-kubernetes-without-upgrading-rancher.md * fixed air-gapped-upgrades.md * fixed dockershim.md * fixed docker-install-commands.md * fixed install-kubernetes.md * fixed infrastructure-private-registry.md * fixed install-rancher-ha * fixed manage-namespaces and tune-etcd-for-large-installs.md * fixed cis-scans/configuration-reference.md * fixed custom-benchmark.md * fixed supportconfig.md * fixed harvester/overview.md * fixed logging-architecture.md * fixed logging-helm-chart-options.md + rm'd unnecessary annotation title * fixed taints-and-tolerances.md * fixed longhorn/overview.md * fixed neuvector/overview.md * fixed monitoring-and-alerting * fixed rancher-cli.md * fixed cluster-configuration.md * fixed monitoring-v2-configuration/examples.md * fixed servicemonitors-and-podmonitors.md * fixed other-troubleshooting-tips/dns.md
70 lines
2.7 KiB
Markdown
70 lines
2.7 KiB
Markdown
---
|
|
title: Working with Taints and Tolerations
|
|
---
|
|
|
|
<head>
|
|
<link rel="canonical" href="https://ranchermanager.docs.rancher.com/integrations-in-rancher/logging/taints-and-tolerations"/>
|
|
</head>
|
|
|
|
"Tainting" a Kubernetes node causes pods to repel running on that node.
|
|
|
|
Unless the pods have a `toleration` for that node's taint, they will run on other nodes in the cluster.
|
|
|
|
[Taints and tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) can work in conjunction with the `nodeSelector` [field](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector) within the `PodSpec`, which enables the *opposite* effect of a taint.
|
|
|
|
Using `nodeSelector` gives pods an affinity towards certain nodes.
|
|
|
|
Both provide choice for the what node(s) the pod will run on.
|
|
|
|
- [Default Implementation in Rancher's Logging Stack](#default-implementation-in-ranchers-logging-stack)
|
|
- [Adding NodeSelector Settings and Tolerations for Custom Taints](#adding-nodeselector-settings-and-tolerations-for-custom-taints)
|
|
|
|
|
|
## Default Implementation in Rancher's Logging Stack
|
|
|
|
By default, Rancher taints all Linux nodes with `cattle.io/os=linux`, and does not taint Windows nodes.
|
|
The logging stack pods have `tolerations` for this taint, which enables them to run on Linux nodes.
|
|
Moreover, most logging stack pods run on Linux only and have a `nodeSelector` added to ensure they run on Linux nodes.
|
|
|
|
This example Pod YAML file shows a nodeSelector being used with a toleration:
|
|
|
|
```yaml
|
|
apiVersion: v1
|
|
kind: Pod
|
|
# metadata...
|
|
spec:
|
|
# containers...
|
|
tolerations:
|
|
- key: cattle.io/os
|
|
operator: "Equal"
|
|
value: "linux"
|
|
effect: NoSchedule
|
|
nodeSelector:
|
|
kubernetes.io/os: linux
|
|
```
|
|
|
|
In the above example, we ensure that our pod only runs on Linux nodes, and we add a `toleration` for the taint we have on all of our Linux nodes.
|
|
|
|
You can do the same with Rancher's existing taints, or with your own custom ones.
|
|
|
|
## Adding NodeSelector Settings and Tolerations for Custom Taints
|
|
|
|
If you would like to add your own `nodeSelector` settings, or if you would like to add `tolerations` for additional taints, you can pass the following to the chart's values.
|
|
|
|
```yaml
|
|
tolerations:
|
|
# insert tolerations...
|
|
nodeSelector:
|
|
# insert nodeSelector...
|
|
```
|
|
|
|
These values will add both settings to the `fluentd`, `fluentbit`, and `logging-operator` containers.
|
|
Essentially, these are global settings for all pods in the logging stack.
|
|
|
|
However, if you would like to add tolerations for *only* the `fluentbit` container, you can add the following to the chart's values.
|
|
|
|
```yaml
|
|
fluentbit_tolerations:
|
|
# insert tolerations list for fluentbit containers only...
|
|
```
|