$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
"なるべくスケジューリングしない" を実現する "PreferNoSchedule" taint
Search
Kazuki Suda
November 25, 2025
Technology
0
140
"なるべくスケジューリングしない" を実現する "PreferNoSchedule" taint
Kubernetes Meetup Tokyo 72 - LT
Kazuki Suda
November 25, 2025
Tweet
Share
More Decks by Kazuki Suda
See All by Kazuki Suda
実践/先取り「入門 Kubernetes Validating/Mutating Admission Policy」 / CloudNative Days Winter 2024
superbrothers
0
33
個人的、Kubernetes の最新注目機能! (2024年5月版)
superbrothers
0
130
Kubernetes + containerd で cgroup v2 に移行したら "failed to create fsnotify watcher" エラーが発生する原因と対策
superbrothers
0
1.5k
Kubernetes にこれから入るかもしれない注目機能!(2022年11月版)
superbrothers
2
1.5k
コミュニティ/ 勉強会紹介
superbrothers
0
250
高可用性、省力運用を目指す 自宅 Kubernetes クラスタ (K8s@home #1)
superbrothers
12
6.1k
KubeCon + CloudNativeCon Europe 2022 Recap
superbrothers
0
74
独断と偏見で選んだ Kubernetes 1.24 の注目機能と今後!
superbrothers
2
8.5k
わかる!metadata.managedFields
superbrothers
4
2.4k
Other Decks in Technology
See All in Technology
re:Invent2025 コンテナ系アップデート振り返り(+CloudWatchログのアップデート紹介)
masukawa
0
350
乗りこなせAI駆動開発の波
eltociear
1
1.1k
ブロックテーマとこれからの WordPress サイト制作 / Toyama WordPress Meetup Vol.81
torounit
0
560
Lambdaの常識はどう変わる?!re:Invent 2025 before after
iwatatomoya
1
460
EM歴1年10ヶ月のぼくがぶち当たった苦悩とこれからへ向けて
maaaato
0
270
Playwright x GitHub Actionsで実現する「レビューしやすい」E2Eテストレポート
kinosuke01
0
580
Playwrightのソースコードに見る、自動テストを自動で書く技術
yusukeiwaki
13
5.3k
形式手法特論:CEGAR を用いたモデル検査の状態空間削減 #kernelvm / Kernel VM Study Hokuriku Part 8
ytaka23
2
460
AWS re:Invent 2025で見たGrafana最新機能の紹介
hamadakoji
0
340
新 Security HubがついにGA!仕組みや料金を深堀り #AWSreInvent #regrowth / AWS Security Hub Advanced GA
masahirokawahara
1
1.9k
AWSを使う上で最低限知っておきたいセキュリティ研修を社内で実施した話 ~みんなでやるセキュリティ~
maimyyym
2
320
ログ管理の新たな可能性?CloudWatchの新機能をご紹介
ikumi_ono
1
660
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
303
21k
Statistics for Hackers
jakevdp
799
230k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.8k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
54k
Become a Pro
speakerdeck
PRO
31
5.7k
Context Engineering - Making Every Token Count
addyosmani
9
500
The Language of Interfaces
destraynor
162
25k
Agile that works and the tools we love
rasmusluckow
331
21k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.8k
Six Lessons from altMBA
skipperchong
29
4.1k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.3k
Transcript
@superbrothers Kubernetes Meetup Tokyo # 7 2 - LT
( 2025 / 11 / 25 ) SUDA Kazuki “なるべくスケジューリングしない” を実現する “PreferNoSchedule” taint
@superbrothers ノードの taint ノードに Pods をスケジューリングしないように制御する機能 2 kind: Node
taints: - key: "key1" value: "value1" effect: "NoSchedule" kind: Pod tolerations: - key: "key1" value: "value1" effect: "NoSchedule" ノードの taints を許容するための設定
@superbrothers ノードの taint: e ff ect の種類 ▶ NoSchedule
+ Pod が合致する toleration を持たなければスケジューリングしない ▶ NoExecute + Pod が合致する toleration を持たなければスケジューリングしない + 既に実 行 中の Pod がノードから排除される ▶ PreferNoSchedule + Pod が合致する toleration を持たなければ ”なるべくスケジューリングしない” 3 目立ってないけど、taints/tolerations が Kubernetes に初めて実装された v1.3 から存在してます。
@superbrothers PreferNoSchedule taint: なるべくスケジューリングしない 4 GPU Node taints: -
key: “nvidia.com/gpu“ effect: “PreferNoSchedule" allocatable: cpu: “36” nvidia.com/gpu: “8” GPU pod resources: requests: cpu: “1000m" limits: nvidia.com/gpu: 8 CPU pod resources: requests: cpu: “1000m" CPU Node allocatable: cpu: “24” GPU ノードにしか入らないのでそのまま入っていく GPU ノードに PreferNoSchedule taint があるので CPU ノードに空きがあればこっちが優先される CPU ノードに空きがなければ GPU ノードに入る
@superbrothers PreferNoSchedule taint の使いどころ ▶ GPU ノードに CPU pods
をなるべくスケジューリングしたくない + GPU ノードに nvidia.com/gpu:PreferNoSchedule taint を付与する + GPU pod をスケジューリングする際に CPU 割り当て量が 足 りずにスケジューリングできない 自 体を避けたいが、CPU ノードのリソースが 足 りない場合は GPU ノードへのスケジューリン グを許容したい ▶ これからメンテナンスするノードに pods を新たになるべくスケジューリングしたくない + メンテ対象の全ノードに maintenance-20251125:PreferNoSchedule taint を付与して 1ノードずつ完了後に削除する + メンテでノード上の pods を drain する際にこれからメンテされるノードではなく、既にメン テが完了したノードになるべくスケジューリングして evict の機会を減らしたい + Cluster API ではクラスタアップグレード時にロールアウト対象ノードに PreferNoSchedule taint を設定することでこれを実現している 5
@superbrothers PreferNoSchedule taint を実現する “TaintToleration” scheduler plugin ▶ 各ノードで
intolerable な (許容できない) taint の個数が最少のノードを100、最多を0の範囲で 線形に正規化する(スコア値が 高 いノードが望ましいノード) 6 func (pl *TaintToleration) Score(ctx context.Context, state fwk.CycleState, pod *v1.Pod, nodeInfo fwk.NodeInfo) (int64, *fwk.Status) { node := nodeInfo.Node() s, err := getPreScoreState(state) if err != nil { return 0, fwk.AsStatus(err) } score := int64(countIntolerableTaintsPreferNoSchedule(node.Spec.Taints, s.tolerationsPreferNoSchedule)) return score, nil } // CountIntolerableTaintsPreferNoSchedule gives the count of intolerable taints of a pod with effect PreferNoSchedule func countIntolerableTaintsPreferNoSchedule(taints []v1.Taint, tolerations []v1.Toleration) (intolerableTaints int) { for _, taint := range taints { // check only on taints that have effect PreferNoSchedule if taint.Effect != v1.TaintEffectPreferNoSchedule { continue } if !v1helper.TolerationsTolerateTaint(tolerations, &taint) { intolerableTaints++ } } return } https://github.com/kubernetes/kubernetes/blob/v 1 . 34 . 2 /pkg/scheduler/framework/plugins/tainttoleration/taint_toleration.go#L 1 8 3 -L 1 9 4
@superbrothers Appendix ▶ Taints and Tolerations | Kubernetes 7