SlideShare a Scribd company logo
1 of 15
Kubernetes Plugin
(Jenkins)
自動化大好きエンジニアLT会 vol.9
■自己紹介
 [名前]: 上畑圭史(うえはたけいじ)
 [Twitter]: いじけまん(@ijikeman)
 [職業]: 株式会社ラクスでインフラ開発部
(リードテックエンジニア)
 [趣味1]: 自作キーボード大好き
アクリル板(4mm)にキーの穴(60個)を手であけた
自キー(自作キーボード)界隈ではちょっとした有名人
 [趣味2]: ピアノ歴5ヵ月(コロナを契機に) … 野菜と将棋で時間
がない
 [趣味3]: 野菜作り(2年目がもうすぐ終わり)
 [趣味4]: 自動化大好きエンジニアLT会登壇(第1~7回)途中下車
 [趣味5]: 息子の将棋教室通いを機に家族全員で将棋にはまる
2
Jenkins Kubernetes Plugin
https://plugins.jenkins.io/kubernetes/
 Kubernetesクラスター上でJenkinsスレーブエージェントを起
動することができる
■Kubernetes Plugin何がいいの?
 Kubernetesクラスター上でJenkinsスレーブエージェントを起
動することができる
[メリット]:
1. Jenkinsスレーブのリソースコントロールを実現
Jenkinsスレーブのリソースコントロール
を実現
[Jenkinsあるある]
同時実行数の増加や高負荷ジョブの実行などでスレーブの負荷が
高くなり、他のジョブに影響
[従来型の対応]
• Jenkinsスレーブを追加する(スケールアウト)
• Jenkinsスレーブのスペックを挙げる(スケールアップ)
Jenkinsマスター Jenkinsスレーブ Jenkinsスレーブ
Out
Jenkinsスレーブ
u
p
スレーブ増強には一定
の時間が必要
Jenkinsスレーブのリソースコントロール
を実現
同時実行数の増加や高負荷ジョブの実行などでスレーブの負荷が
高くなり、他のジョブに影響
[Kubernetes Pluginの対応]
• ノードのリソースを増強(スケールアップ)
• ノードを増やして拡張(スケールアウト)
• コンテナのリソース制限が設定できる
• Kubernetesがリソース状況を判断し、適切なノードに配置
Kubernetes クラスタ
ノード ノード ノード
ノード
Out u
p
Cgroupによるリソース制限
CPU/メモリ
空いてるから起動
■Kubernetes Plugin何がいいの?
 Kubernetesクラスター上でJenkinsエージェントを起動するこ
とができる
[メリット]:
1. Jenkinsスレーブのリソースコントロールを実現
2. Jenkinsスレーブの可用性向上
Jenkinsスレーブの可用性向上
ジョブ内で指定したスレーブが障害等で停止していた場合は、
ジョブが実行されない
[従来型の対応]
• Jenkinsスレーブを複数台構成に
※ただしJenkinsスレーブは同じ構成で構築する必要がある
• JenkinsスレーブをHA構成にして可用性を確保
Jenkinsマスター Jenkinsスレーブ Jenkinsスレーブ Jenkinsスレーブ
同じ構成じゃないと
Ansibleの実行に失敗
Jenkinsスレーブの可用性向上
ジョブ内で指定したスレーブが障害等で停止していた場合は、
ジョブが実行されない
[Kubernetes Pluginの対応]
• 実行環境はコンテナイメージなのでどのノードでも
Jenkinsジョブは動く(環境差異なし)
• 同じような解決策としてDocker Pluginもある(※後述)
Kubernetes クラスタ
ノード ノード ノード ノード
ノード障害に
強い構成
Jenkinsマスター
■Kubernetes Plugin何がいいの?
 Kubernetesクラスター上でJenkinsエージェントを起動するこ
とができる
[メリット]:
1. Jenkinsスレーブのリソースコントロールを実現
2. Jenkinsスレーブの可用性向上
3. コンテナイメージ内にJenkins-Agentが不要
コンテナイメージ内にJenkins-Agent不要
[Jenkinsスレーブ on Docker(Docker Plugin)の場合]
• ジョブを実行するコンテナイメージにJenkins-Agentを内包する必要
がある
つまり、「Jenkins-Agent」+「ジョブ実行に必要な機能」のコンテナイ
メージが必要
Jenkinsマスター
Jenkins-Agent
が必要
Dockerホスト
コンテナイメージ コンテナイメージ
ラクスの今の構成
コンテナイメージ内にJenkins-Agent不要
# jenkins-ansible/Dockerfile
FROM jenkins/inbound-agent:4.10-alpine-jdk8
RUN apk add ansible
FROM jenkins/inbound-agent:4.10.3-alpine-jdk8
RUN apk add ansible
[Jenkinsスレーブ on Docker(Docker Plugin)の場合]
• ジョブを実行するコンテナイメージにJenkins-Agentを内包する必要
がある
つまり、「Jenkins-Agent」+「ジョブ実行に必要な機能」のコンテナイ
メージが必要
➡ Jenkins-Agentのバージョンが
変わるとイメージの再ビルドが必要
FROM jenkins/inbound-agent:4.10-alpine-jdk8
RUN apk add ansible
FROM jenkins/inbound-agent:4.10.3-alpine-jdk8
RUN apk add ansible
FROM Jenkins-ansible:4.10.3-alpine-jdk8
RUN apk add ansible-lint
# jenkins-ansible-lint/Dockerfile
まじ
むり
コンテナイメージ内にJenkins-Agent不要
[Jenkins-Slave on Kubernetesの場合]
• Jenkinsマスターと連携するJenkinsスレーブとジョブ実行に必要な
機能のコンテナがジョブ実行時に分かれて起動
つまり「ジョブ実行に必要な機能」のコンテナイメージのみ用意すれば
よい
Kubernetes クラスタ
ノード ノード ノード ノード
Jenkins-agent不要
Jenkinsマスター
ジョブA
実行
ジョブB
実行
Kubernetes Plugin
ぜひ使ってみてください
おわり。

More Related Content

Recently uploaded

Recently uploaded (8)

情報を表現するときのポイント
情報を表現するときのポイント情報を表現するときのポイント
情報を表現するときのポイント
 
LoRaWAN無位置ロープ式水漏れセンサーWL03A 日本語マニュアル
LoRaWAN無位置ロープ式水漏れセンサーWL03A 日本語マニュアルLoRaWAN無位置ロープ式水漏れセンサーWL03A 日本語マニュアル
LoRaWAN無位置ロープ式水漏れセンサーWL03A 日本語マニュアル
 
ネットワーク可視化 振る舞い検知(NDR)ご紹介_キンドリル202405.pdf
ネットワーク可視化 振る舞い検知(NDR)ご紹介_キンドリル202405.pdfネットワーク可視化 振る舞い検知(NDR)ご紹介_キンドリル202405.pdf
ネットワーク可視化 振る舞い検知(NDR)ご紹介_キンドリル202405.pdf
 
Keywordmap overview material/CINC.co.ltd
Keywordmap overview material/CINC.co.ltdKeywordmap overview material/CINC.co.ltd
Keywordmap overview material/CINC.co.ltd
 
MPAなWebフレームワーク、Astroの紹介 (その1) 2024/05/17の勉強会で発表されたものです。
MPAなWebフレームワーク、Astroの紹介 (その1) 2024/05/17の勉強会で発表されたものです。MPAなWebフレームワーク、Astroの紹介 (その1) 2024/05/17の勉強会で発表されたものです。
MPAなWebフレームワーク、Astroの紹介 (その1) 2024/05/17の勉強会で発表されたものです。
 
2024年5月17日 先駆的科学計算フォーラム2024 機械学習を用いた新たなゲーム体験の創出の応用
2024年5月17日 先駆的科学計算フォーラム2024 機械学習を用いた新たなゲーム体験の創出の応用2024年5月17日 先駆的科学計算フォーラム2024 機械学習を用いた新たなゲーム体験の創出の応用
2024年5月17日 先駆的科学計算フォーラム2024 機械学習を用いた新たなゲーム体験の創出の応用
 
LoRaWAN無位置ロープ型水漏れセンサー WL03A-LB/LSカタログ ファイル
LoRaWAN無位置ロープ型水漏れセンサー WL03A-LB/LSカタログ ファイルLoRaWAN無位置ロープ型水漏れセンサー WL03A-LB/LSカタログ ファイル
LoRaWAN無位置ロープ型水漏れセンサー WL03A-LB/LSカタログ ファイル
 
Hyperledger Fabricコミュニティ活動体験& Hyperledger Fabric最新状況ご紹介
Hyperledger Fabricコミュニティ活動体験& Hyperledger Fabric最新状況ご紹介Hyperledger Fabricコミュニティ活動体験& Hyperledger Fabric最新状況ご紹介
Hyperledger Fabricコミュニティ活動体験& Hyperledger Fabric最新状況ご紹介
 

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

20221102_automation_lt09.pptx