Skip to Content
入門 Kubernetes
book

入門 Kubernetes

by Kelsey Hightower, Brendan Burns, Joe Beda, 松浦 隼人
March 2018
Intermediate to advanced
248 pages
2h 51m
Japanese
O'Reilly Japan, Inc.
Content preview from 入門 Kubernetes

10章Job

ここまでは、データベースやWebアプリケーションといった、長期間動き続けるプロセスに焦点を当てて見てきました。こういったワークロードは、アップグレードするか不要になるその時点まで動き続けます。Kubernetesクラスタ上のワークロードの多くは、こういった長期間動き続けるプロセスですが、1回限りの短い時間しか動かさない処理もあります。Jobオブジェクトは、そのような短時間だけ動かすタスクを扱うものです。

通常のPodは戻り値に関係なく動き続けますが、Jobは、処理が正常終了する(戻り値0での終了など)まで動くPodを作成します。Jobは、データベースマイグレーションやバッチ処理など、1度しか動かさない処理を実行するのに便利です。1度限りの処理に通常のPodを使うと、データベースマイグレーションタスクがループし、データベースに同じ処理を何度も行うことになってしまいます。

この章では、Kubernetesで実行できる一般的なJobのパターンを見ていきます。また、それらのパターンを実際のシナリオに当てはめて考えます。

10.1 Jobオブジェクト

Jobオブジェクトは、Jobの設定に書かれたテンプレートで定義されたPodの作成や管理を行います。これらのPodは、処理が成功するまで動き続けます。Jobオブジェクトは、複数のPodを並列に動かすための調整も行います。

処理が完了する前に失敗した場合、JobコントローラはJobの設定内のPodテンプレートを元に、新しいPodを作成します。Podは必ずどこかのノードに割り当てられる必要があるので、必要なリソースをスケジューラが見つけられない場合、すぐにJobが実行されない可能性もあります。また、分散システムの性質上、障害の発生時には、同じタスクを実行するPodが複数作られることもあり得ます。 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Hands-On Microservices with Kubernetes

Hands-On Microservices with Kubernetes

Gigi Sayfan
Docker

Docker

Adrian Mouat, Sky株式会社 玉川 竜司
Hands-on Kubernetes

Hands-on Kubernetes

Sander van Vugt

Publisher Resources

ISBN: 9784873118406Other