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
Transcript
11 slides
オリジナルの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クラスタを制御す るアプリを作ろう
More Decks by katsunori nakajima
See All by katsunori nakajima
Kubernetesクラスタを組む
karosuwindam
0
440
Other Decks in Business
See All in Business
open-slideの紹介
kotasugiki
0
130
Kiro Crew で re:Invent 2026の準備をした話
maijun
0
320
セキサーマル株式会社 会社紹介資料
sekithermal
0
400
G-gen 会社概要
ggen
0
1.5k
【UMed】Company Deck_261026
ryushu
0
400
会社説明資料
xinghr
0
4.4k
決めたことより、「なぜ決めたか」を残す
doiko123
0
470
インキュデータ会社紹介資料
okitsu
3
62k
株式会社なぞる 会社概要
nazoru
0
180
株式会社ユビレジ_採用ピッチ資料 / Ubiregi_CompanyProfile
ubiregi_saiyo
1
12k
enechain company deck_english
enechain
PRO
1
780
4 operating model upgrades for success with AI - Matthew Skelton - Enterprise AI Summit - Bletchley Park, UK
matthewskelton
PRO
0
640
Featured
See All Featured
Heart Work Chapter 1 - Part 1
lfama
PRO
11
37k
How to Talk to Developers About Accessibility
jct
2
620
SEO for Brand Visibility & Recognition
aleyda
0
4.9k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
48k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.1k
From π to Pie charts
rasagy
1
450
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.7k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.7k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
640
Building Flexible Design Systems
yeseniaperezcruz
330
41k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.2k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.3k