美文网首页
Kubernetes YAML 详解之污点和容忍度(taints

Kubernetes YAML 详解之污点和容忍度(taints

作者: 河码匠 | 来源:发表于2023-02-17 14:24 被阅读0次

一、Node 的 node.spec.taints 字段,节点定义污点

字段 值类型 说明
* effect string 污点效果
NoExecute: 完全不允许在节点上运行资源,已运行的会被驱逐
NoSchedule: 此节点不参与资源创建的调度,但不影响已经创建的资源
PreferNoSchedule: 软污点,满足条件使用该节点,所有节点都不能满足也可以创建资源
* key string 标签的 key
timeAdded string
value string 标签的值

节点定义污点

kubectl taint nodes node1 node-aaa=bbbbbb:NoSchedule

二、 pod 的 pod.spec.tolerations 字段,容忍程度

kubectl explain pod.spec.tolerations
字段 值类型 说明
operator string 匹配方式 (类似 pod 亲和性中的 operator: In )
equal:相同
Exists:有一个匹配就行
effect string 容忍程度,当但 operatorExist 可空,都容忍

NoExecute: 完全不允许在节点上运行资源,已运行的会被驱逐
NoSchedule: 此节点不参与资源创建的调度,但不影响已经创建的资源
PreferNoSchedule: 软污点,满足条件使用该节点,所有节点都不能满足也可以创建资源
key string 标签的 key
tolerationSeconds string effectNoExecute 配合,否则无效,能容忍 pod 存在多久,多久以后驱逐 pod
value string 标签的值,当 operatorExist 可空

示例:

pod 容忍污点

spec:
  ......
  tolerations:              # 定义容忍度
  - key: "node-aaa"         # node 中污点的 key
    operator: "Equal"       # 匹配策略 相等
    value: "bbbbbb"         # 污点 key 的值
    effect: "NoExecute"     # 污点策略
    tolerationSeconds: 3600 # 3600 秒后被驱逐 和 NoExecute 类型配合

相关文章

网友评论

      本文标题:Kubernetes YAML 详解之污点和容忍度(taints

      本文链接:https://www.haomeiwen.com/subject/itnmkdtx.html