Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
OpenShiftでスポットVMを使おう.pdf
Search
jpishikawa
January 27, 2023
Technology
980
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
OpenShiftでスポットVMを使おう.pdf
jpishikawa
January 27, 2023
More Decks by jpishikawa
See All by jpishikawa
vLLM Community Meetup Tokyo #3 オープニングトーク
jpishikawa
0
760
OpenShiftでllm-dを動かそう!
jpishikawa
0
400
vLLM meetup Tokyo
jpishikawa
1
800
OpenShift AIに含まれるOSSについて解説
jpishikawa
0
2k
CNDT2023 Community LT KubeVirtでVMが起動する仕組み
jpishikawa
0
380
Gitによるソースコード管理入門.pdf
jpishikawa
1
1.2k
Other Decks in Technology
See All in Technology
HolmesGPTで始めるSREエージェント入門!プラットフォームの障害調査はAIにお任せ 〜
leveragestech
PRO
0
140
生成AIで高い生産性を求められて、 悩み、乗り越えた話
mot_techtalk
2
120
雪かき部 #7 もう怖くない!SELECT文!
foursue
0
280
【データ横丁主催】AI Agentがコンテキストを使って仕事をした後、何が残るのか― 組織の経験を次の判断に引き継ぐ「Agent Memory」
shisyu_gaku
2
320
AI駆動開発、viviONの1年 ── うまくいったこと・いかなかったこと
vivion
0
170
データ品質を壊しながらSnowflakeのAIに分析させてみた
kawanago
0
480
並行性の問題を防げ!実践トランザクション入門
occhi
0
250
生成AIと進める探索的データ分析(2026.10.03 第122回Tokyo.R勉強会)
tatamiya
2
1.4k
顧客の成果創出とプロダクトの成長を 両立するためのFDE
sansantech
PRO
0
670
SREでアラート疲れを 解決しよう!
kairim0
1
140
[AWS 秋のクラウドオペレーション祭り 2026]AWS DevOps Agentで変わるリリースと運用対応 ~リリース管理機能と Directed actions のご紹介~
furuton
1
120
AIは爆速なのに、私が詰まっていた話 ― 音声入力と鳴くマスコットでボトルネックを削る
yama3133
0
510
Featured
See All Featured
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
260
Statistics for Hackers
jakevdp
799
230k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
970
The Mindset for Success: Future Career Progression
greggifford
PRO
0
520
The Cult of Friendly URLs
andyhume
79
7k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
340
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
Discover your Explorer Soul
emna__ayadi
2
1.3k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
860
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
260
Transcript
OpenShiftで スポットVMを使おう Junpei Ishikawa OpenShift.Run 2023
今日お伝えしたいこと クラウドでOpenShiftを使っていてコストを減らしたいなら スポットVMを使うといいよ
スポットVMについて 様々なクラウドで提供されている VMの利用形態の一つです。 VMの余剰リソースを使うことで 大幅な割引を受けながらインフラを利用することができます。 AWS Azure GCP 共通する要素 •
余剰リソースを使うことで非常に安くVMを利用す ることが出来る • クラウドのリソース利用量の増加に応じて、通知 のあとVMが停止されることがある • SLAが保証されない
*: 実際の割引額はクラウドごと、使用するリージョン、VMタイプ、等の要因が加味され変動します。 スポットVMについて 様々なクラウドで提供されている VMの利用形態の一つです。 VMの余剰リソースを使うことで 大幅な割引を受けながらインフラを利用することができます。 AWS Azure GCP
共通する要素 • 余剰リソースを使うことで非常に安くVMを利用す ることが出来る • クラウドのリソース利用量の増加に応じて、通知 のあとVMが停止されることがある • SLAが保証されない 異なる要素(抜粋) Spot Instances サービス名 Spot Virtual Machines Preemptible VMs Spot VMs 最大90% 割引額* 最大90% 60 - 91% 120秒 停止までの猶予 30秒 30秒
スポットVMに向いているワークロード 任意のタイミングでVMが停止される可能性があることからステートレスなアプリケーションや、短時間 で完了するジョブへの利用に向きます。また高可用性が必須でない開発環境のワークロードにも適用 できます。 スポットVMに向いている • ステートレスアプリケーション • ウェブアプリケーション •
APIサーバー • 短時間で完了するジョブ • 分散データ処理 • 開発/テスト環境 スポットVMに向かない • ステートフルアプリケーション • 長時間かかるジョブ • 高可用性が求められる本番環境
コンテナはスポットVMに向いている コンテナは内部にデータを保持しないため、スポット VMと相性が良いと言えます。 アプリデータ DB、PV、オブジェクト ストレージ等に保存 ログ等 エージェントが 収集して転送
OpenShiftでのスポットVM利用方法 クラスタに新たなVMを追加する際、MachineSetに記述を加えるか、コンソールからオプションを選択 することでスポットVMを利用できます。 apiVersion: machine.openshift.io/v1beta1 kind: MachineSet metadata: name: spot-worker-us-east-2a
namespace: openshift-machine-api spec: replicas: 1 … providerSpec: value: spotMarketOptions: {} スポットVMを使うための 記述を一行追加 ROSAやOSDの場合 MachinePool追加時に チェックを入れるだけで スポットVMを利用可能
VM停止通知にどのように対応するか スポットVMを安全に利用するためには、 VM停止通知を受け安全にコンテナを終了する必要がありま す。OpenShiftではスポットVM利用時に専用のPodが立ち上がりこの通知を受け取ります。 machine.openshift.i o/interruptible-ins tance: '' Label machine.openshift.i
o/interruptible-ins tance: '' Label machine.openshift.i o/interruptible-ins tance: '' Label machine-api- termination-handler machine-api- termination-handler machine-api- termination-handler 通常のノード スポットVM http://169.254.169.254/…/ (メタデータエンドポイント) 5秒おきにメタデータにアクセスし 自ノードが停止対象と なっていないかをチェック スポットVMには それを表すラベルが ノードに付与される 停止処理を行う machine-api-termination- handler Podが DaemonSetとして起動 "msg"="Instance not marked for termination" "namespace"="openshift-machine-api" "node"="ip-10-0-196-218.us-east-2.compute.internal" 1 2 3
1 スポットVMの停止処理 machine-api-termination-handlerはメタデータからVM停止の通知を受け取るとノードの ステータスを変更し、それを受け PodのDrainが実行されます。 machine-api- termination-handler status: conditions: -
type: Terminating status: 'True' lastHeartbeatTime: '2023-01-19T06:25:20Z' lastTransitionTime: '2023-01-19T06:25:20Z' reason: TerminationRequested message: The cloud provider has marked this instance for termination ノードの ステータスを 更新 machine-healthcheck- controller ステータスを チェック Drainの実施 新規VM作成 2 3 3
preStop設定がなければDrain直後か らSIGTERM処理を実行 デフォルトではServiceからの除外処理と PodのSIGTERMが同時に始まる ため、preStop処理を設定して安全に 停止できるようにする Podの停止処理 ノードのDrainが実行されるとPodの終了処理が行われます。クラウドごとにスポット VMが停止されるま での猶予が異なるため時間内に停止できるよう設定を行いましょう。
Running Terminating Drain preStop処理 SIGTERM処理 SIGKILL処理 terminationGracePeriodsSeconds Serviceからの除外処理 Podの終了プロセス Pod削除 クラウドのスポットVMの仕様によっては デフォルトのterminationGracePeriodsSeconds(30秒) より先にVMが停止する可能性がある。そのため スポットVMで動かすPoDのアプリは素早く終了処理を行うこと ができる必要がある。 AWS Azure GCP Termination Handler が通知を受 け取ってから停止までの猶予 約116 〜 120秒 約26 〜 30秒 約26 〜 30秒
デモ
スポットVM停止のテスト AWS Fault Injection Simulatorというサービスでは意図したタイミングでスポット VMの停止を起こすこと ができます。そのため VM停止の際にアプリが想定通りの挙動を示すか確認できます。 AWS FISで実行する
アクションを定義 対象のスポットVMを選 択 実験テンプレートの作成 実験の実施
まとめ:私がスポットVMを勧める理由 ❏ OpenShiftでは意外と簡単にスポットVMを 利用することができる。 ❏ スポットVM利用時に気を付ける必要がある VMの 停止をいい感じにハンドリングしてくれる。 ❏ 正しく使えばアプリの可用性を損なわず
コスト削減できる。
linkedin.com/company/red-hat youtube.com/user/RedHatVideos facebook.com/redhatinc twitter.com/RedHat Red Hat is the world’s leading
provider of enterprise open source software solutions. Award-winning support, training, and consulting services make Red Hat a trusted adviser to the Fortune 500. Thank you