Upgrade to Pro — share decks privately, control downloads, hide ads and more …

kube-scheduler-simulatorを用いたSchedulerのシミュレーションとその仕組み

sanposhiho
September 28, 2021
420

 kube-scheduler-simulatorを用いたSchedulerのシミュレーションとその仕組み

Kubernetes Meetup Tokyo #45 での資料です
https://k8sjp.connpass.com/event/223232/

sanposhiho

September 28, 2021
Tweet

More Decks by sanposhiho

Transcript

  1. 自己紹介
 中田 健誠 / Kyoto Uni (4th year)
 普段はバックエンドエンジニアをしてます
 


    Twitter: @sanpo_shiho
 GitHub: @sanposhiho
 
 member of Kubernetes/Kubernetes SIGs

  2. Scheduling Framework
 Scheduling Framework (の Scheduling Cycle) のうち、
 • Filter

    (+ PreFilter)
 • Score (+ PreScore)
 • Normalized Score 
 の結果が主にNodeの決定に影響している (+ Plugin Weight)
 ※ Extenderについては今回は割愛して説明します。 (scheduler simulatorでもExtenderには現状対応していません。) 
 
 9
  3. 10

  4. 20 Score B プラグインの Weightが1
 → 10
 → 50
 Score

    A プラグインの Weightが10
 → 300
 → 500

  5. 仕組みざっくりまとめ
 Scheduler は Scheduling Framework の流れに沿って動作
 • Filter で実行できない/したくないNodeを弾き、
 •

    Score, Normalized Score でNodeをスコアリングし、
 • 最後にPlugin Weightを加味して、
 • どのNodeでPodを実行するか決定する
 
 22
  6. Kubernetes scheduler simulator
 
 
 • フロントエンド + バックエンド +

    etcd を立ち上げるだけ
 ◦ 内部的に Kubernetes のクラスターを立ち上げているわけではない 
 ◦ docker image をk8s.gcr.ioから公開予定 
 
 27
  7. Background
 • Scheduler がその Node を選んだ理由は簡単に見ることができない
 ◦ ログレベルをあげる必要がある (v=10) 


    ◦ ログを確認するには強い権限が必要 
 ◦ ログだと見にくい (主観) 
 • Scheduler の検証には実際のクラスターを立ち上げる必要がある
 ◦ そのクラスター上で特定のリソースの状況を作るのもめんどくさい 
 28
  8. 29

  9. Kubernetes scheduler simulator の仕組み
 Scheduler に必要なコンポーネントのみを実行
 (scheduler_perfの仕組みを参考にしている)
 
 
 scheduler_perfについて詳しくは


    こちらのスライドを参照 →
 
 
 https://speakerdeck.com/sanposhiho/kuberneteshaschedulerfalsepahuomansuwodofalseyouniji-ce-siteiruka
 42
  10. プラグインの結果の収集まとめ
 1. スケジュールの際に Filter メソッドが呼び出される
 2. Filter メソッド内で元のプラグインの Filter メソッドを呼び出して結果を取得


    3. 取得した結果を resultstore に記録
 4. (スケジュールが進む)
 5. スケジュールの終了時にresultstore が結果を Pod の annotation に記録
 ↓↑結果の記録
 54
  11. まとめ
 • Scheduler では内部で様々なPluginが動作している
 • Kubernetes scheduler simulatorでは、Pluginごとの動作を検証しつつ、Schedulerを シミュレートできる
 •

    内部的にはSchedulerに必要なコンポーネントのみを立ち上げ、Pluginを動的に入 れ替えることでPluginの結果の取得を可能にしている
 • feature request/bug報告などお待ちしています
 55