节点选择与调度

本页介绍 ScanScanSuite 共享使用的调度和节点选择字段。

这些字段的配置位置

相同的调度概念在两个资源中都有体现,但字段路径不同:

概念Scan 路径ScanSuite 路径
Scan 类型spec.scanTypespec.scanTemplate.scanType
节点范围策略spec.nodeScopeStrategyspec.scanTemplate.nodeScopeStrategy
目标节点角色spec.targetNodeRolesspec.scanTemplate.targetNodeRoles
节点选择器spec.nodeSelectorspec.scanTemplate.nodeSelector

参数行为

参数描述
scanType支持 platformnodeall。在 platform 模式下,系统仅扫描 Kubernetes 资源;在 node 模式下,系统仅扫描节点文件。
nodeScopeStrategy支持 automanual。auto 模式下,节点根据规则特定的范围定义进行选择;manual 模式下,所有规则均在指定节点上执行。
targetNodeRoles可选。限制节点角色。有效值包括 control-planeworker
nodeSelector可选。使用节点标签进行选择。

nodeScopeStrategy 行为

策略描述
auto节点根据基准规则的 spec.nodeScope 自动选择。Kube-bench 通过 benchmark.file.type 映射节点。如果没有匹配,则不会创建作业。
manual在所有匹配节点上运行,忽略规则特定的 nodeScope

过滤规则

当同时配置了 targetNodeRolesnodeSelector 时,它们在节点过滤时共同作为交集生效。

针对 Profile 的限制

重要说明:

  • 操作系统扫描需要 scanType: node
  • CIS 仅支持 scanType: node,不支持 platformall,因为 kube-bench 不支持规则级别的节点选择。
  • STIG 支持 platformnodeall
  • CIS 和 STIG 基线的调度规则不同,因此不应在同一个 ScanSuite 中混合使用。