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
オリジナルのKubectlを作る
Search
katsunori nakajima
June 25, 2021
Business
440
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
オリジナルのKubectlを作る
katsunori nakajima
June 25, 2021
More Decks by katsunori nakajima
See All by katsunori nakajima
Kubernetesクラスタを組む
karosuwindam
0
440
Other Decks in Business
See All in Business
個人のふりかえりをアップデートした話
pokotyamu
0
180
데이터 분석가의 커리어 설계
datarian
0
250
Unstuck: Laying the Foundations for Fast Flow in a Public Sector Regulator
benedictsteele
PRO
0
180
Annual Session - Teknik Lobi dan Negosiasi
adeputra13
0
350
Crisp Code inc.|コーポレート・サービス紹介 - Corporate & Services Introduction
so_kotani
0
690
Avoiding the "Bad Training, Faster" Trap in the Age of Al
tmiket
0
770
キャンバスエッジ株式会社 会社説明資料
canvasedge
0
21k
「まず自分が背中を見せる」から始まった ──「打席に立ち続ける」ことで技を磨き、縁を結ぶということ
natty_natty254
5
640
人は呼び方で行動が変わる / The Stance That Comes Before Scrum
aokiplayer
0
470
Daudzdzīvokļu ēku energoefektivitāte Latvijā - 2026. gads
dzivosiltak
PRO
0
130
Your AI doesn’t have a point of view.
macgupta
0
150
会社説明資料
xinghr
0
4.1k
Featured
See All Featured
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
3
1.2k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
1
300
Documentation Writing (for coders)
carmenintech
77
5.6k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
470
Exploring anti-patterns in Rails
aemeredith
4
560
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
550
Building Applications with DynamoDB
mza
96
7.3k
Unsuck your backbone
ammeep
672
58k
ラッコキーワード サービス紹介資料
rakko
5
5.7M
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Transcript
オリジナルのKubectlを作 る 2021/06/25
Kubectlとは • Kuberentesの制御のCUIツール • DeploymentやServiceなどのリソース情報を制御できる • ~/.kube/configに書かれた情報(kubeconfig)をもとに Kubernetesネットワークにアクセスする
Kubectl get pod –A kubectl –n namespace describe pod kubectl
get service –A kubectl –n namespace describe service
PodとServiceを調べたりすることを ワンラインでできないのか?
Client-goというgo言語のライブラリがあ る
Client-goとは • KubernetesのAPIをたたくGo言語のライブラリ • これを使用すれば、Kubernetesの制御をプログラミングできる
使用するには • Go言語 v1.16以上のインストール • Kubernetes環境 • Kubeconfig(ローカルテスト用) • VS
Code(開発環境)
Go言語の使い方 • Go言語をv1.14からv1.16にアップデートで苦労したので • modファイルを作らないとbuildができない • go init mod 適当な名前
• 使用するpackageはmodに書かれていないとエラー • go get パッケージ • 「./フォルダ」で呼び出していたローカルライブラリの書き方 は、「モジュール名/フォルダ」で呼び出すことが可能
• 300行ぐらいで、以下のようなアプリができた。
まとめなど • Client-goを使用して、pod名とネームスペース、それに紐づい たserviceやポートを取得するアプリができた。 • コンテナ化して、podの情報監視も可能
Client-goを使用して Kubernetesクラスタを制御す るアプリを作ろう