feat(k3s): add node taints configuration and update documentation
这个提交包含在:
@@ -98,6 +98,31 @@ kubectl get nodes
|
|||||||
| `enable_lb` | bool | - | 启用 K3s LB |
|
| `enable_lb` | bool | - | 启用 K3s LB |
|
||||||
| `netfilter_mode` | string | "" | Tailscale netfilter: off/nodivert/on |
|
| `netfilter_mode` | string | "" | Tailscale netfilter: off/nodivert/on |
|
||||||
| `node_labels` | dict | - | 自定义标签 |
|
| `node_labels` | dict | - | 自定义标签 |
|
||||||
|
| `node_taints` | list | - | 节点污点 (格式: key=value:effect) |
|
||||||
|
|
||||||
|
### 节点污点示例
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
masters:
|
||||||
|
hosts:
|
||||||
|
master1:
|
||||||
|
ansible_host: 10.0.0.1
|
||||||
|
node_taints:
|
||||||
|
- "node-role.kubernetes.io/control-plane:NoSchedule"
|
||||||
|
- "dedicated=gpu:NoSchedule"
|
||||||
|
|
||||||
|
agents:
|
||||||
|
hosts:
|
||||||
|
gpu-node:
|
||||||
|
ansible_host: 10.0.0.10
|
||||||
|
node_taints:
|
||||||
|
- "nvidia.com/gpu:NoSchedule"
|
||||||
|
```
|
||||||
|
|
||||||
|
常用污点效果(Effect):
|
||||||
|
- **NoSchedule**: 不允许新 Pod 调度到此节点
|
||||||
|
- **PreferNoSchedule**: 尽量不调度(软限制)
|
||||||
|
- **NoExecute**: 驱逐已有 Pod 并禁止新 Pod
|
||||||
| `kubelet_reserved` | string | - | 资源预留: cpu=500m,memory=512Mi |
|
| `kubelet_reserved` | string | - | 资源预留: cpu=500m,memory=512Mi |
|
||||||
|
|
||||||
## 环境变量
|
## 环境变量
|
||||||
|
|||||||
@@ -22,16 +22,22 @@ all:
|
|||||||
cluster_init: true
|
cluster_init: true
|
||||||
node_region: cn-sh
|
node_region: cn-sh
|
||||||
use_mirror: true
|
use_mirror: true
|
||||||
|
node_taints:
|
||||||
|
- "node-role.kubernetes.io/control-plane:NoSchedule"
|
||||||
tcb:
|
tcb:
|
||||||
ansible_host: tcb.node.dev.cm
|
ansible_host: tcb.node.dev.cm
|
||||||
node_hostname: tcb
|
node_hostname: tcb
|
||||||
node_region: cn-sh
|
node_region: cn-sh
|
||||||
use_mirror: true
|
use_mirror: true
|
||||||
|
node_taints:
|
||||||
|
- "node-role.kubernetes.io/control-plane:NoSchedule"
|
||||||
tcc:
|
tcc:
|
||||||
ansible_host: tcc.node.dev.cm
|
ansible_host: tcc.node.dev.cm
|
||||||
node_hostname: tcc
|
node_hostname: tcc
|
||||||
node_region: cn-sh
|
node_region: cn-sh
|
||||||
use_mirror: true
|
use_mirror: true
|
||||||
|
node_taints:
|
||||||
|
- "node-role.kubernetes.io/control-plane:NoSchedule"
|
||||||
|
|
||||||
# Agent 节点 (Worker)
|
# Agent 节点 (Worker)
|
||||||
agents:
|
agents:
|
||||||
|
|||||||
@@ -20,6 +20,14 @@ node-label:
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
# 节点污点
|
||||||
|
{% if node_taints is defined %}
|
||||||
|
node-taint:
|
||||||
|
{% for taint in node_taints %}
|
||||||
|
- "{{ taint }}"
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
# Kubelet 资源预留
|
# Kubelet 资源预留
|
||||||
{% if kubelet_reserved is defined %}
|
{% if kubelet_reserved is defined %}
|
||||||
kubelet-arg:
|
kubelet-arg:
|
||||||
|
|||||||
@@ -46,3 +46,11 @@ node-label:
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
# 节点污点
|
||||||
|
{% if node_taints is defined %}
|
||||||
|
node-taint:
|
||||||
|
{% for taint in node_taints %}
|
||||||
|
- "{{ taint }}"
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
在新议题中引用
屏蔽一个用户