apiVersion: v1
import "k8s.io/api/core/v1"
Toleration {#Toleration}
该容忍度所关联的 Pod,能够容忍任何与三元组 <key, value, effect>
相匹配的污点,匹配依据由 <operator> 指定。
<hr>
<table> <thead><tr><th>字段</th><th>描述</th></tr></thead> <tbody> <tr> <td><code>effect</code><br/><em>string</em></td> <td>
<code>effect</code> 指定要匹配的污点效应(taint effect)。留空表示匹配所有污点效应。
若指定该字段,允许的值包括 <code>"NoSchedule"</code>、<code>"PreferNoSchedule"</code>。
<br/>
<br/>
可能的枚举值:<br/>
- <code>"NoExecute"</code> 驱逐所有无法容忍该污点且正在运行的 Pod。
该策略目前由 NodeController 强制执行。<br/>
- <code>"NoSchedule"</code> 除非 Pod 能够容忍该污点,否则不允许将新的 Pod 调度到该节点上;
但允许所有绕过调度器直接提交给 kubelet 的 Pod 启动,
也允许所有已在运行的 Pod 继续运行。该策略由调度器强制执行。<br/>
- <code>"PreferNoSchedule"</code> 类似于 <code>"NoSchedule"</code>,
但调度器会尽量避免将新的 Pod 调度到该节点上,而不是完全禁止调度。
该策略由调度器强制执行。
</td>
</tr>
<tr>
<td><code>key</code><br/><em>string</em></td>
<td>
<code>key</code> 是该容忍度所适用的污点键(taint key)。若为空,则表示匹配所有污点键。
如果 <code>key</code> 为空,<code>operator</code> 必须为 <code>"Exists"</code>;
这种组合意味着匹配所有键和所有值。
</td>
</tr>
<tr>
<td><code>operator</code><br/><em>string</em></td>
<td>
<code>operator</code> 表示键(key)与值(value)之间的关系。
有效的运算符包括 <code>Exists</code>、<code>Equal</code>、<code>Lt</code>、<code>Gt</code>,
默认值为 <code>Equal</code>。<code>"Exists"</code> 相当于值的通配符,使得
Pod 能够容忍特定类别下的所有污点。<code>Lt</code> 和 <code>Gt</code>
执行数值比较(需要启用 TaintTolerationComparisonOperators 特性门控)。<br/>
<br/>
可能的枚举值:<br/>
- `"Equal"`<br/>
- `"Exists"`<br/>
- `"Gt"`<br/>
- `"Lt"`
</td>
</tr>
<tr>
<td><code>tolerationSeconds</code><br/><em>integer</em></td>
<td>
<code>tolerationSeconds</code> 表示容忍(其 <code>effect</code>
必须为 <code>"NoExecute"</code>,否则该字段将被忽略)针对污点生效的时长。
默认情况下该字段未设置,意味着永久容忍该污点(不进行驱逐)。
系统会将 0 或负值视为 0(即立即驱逐)。
</td>
</tr>
<tr>
<td><code>value</code><br/><em>string</em></td>
<td>
<code>value</code> 是容忍度所匹配的污点值(taint value)。如果运算符(operator)为
<code>Exists</code>,则该值应为空;否则,它应为一个普通字符串。
</td>
</tr>
</tbody> </table>
来源:Kubernetes 文档贡献者 · 作者与贡献记录 · CC BY 4.0。离线整理了版式、链接和媒体显示。
