Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
オリジナルのKubectlを作る
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
katsunori nakajima
June 25, 2021
Business
420
0
Share
オリジナルのKubectlを作る
katsunori nakajima
June 25, 2021
More Decks by katsunori nakajima
See All by katsunori nakajima
Kubernetesクラスタを組む
karosuwindam
0
420
Other Decks in Business
See All in Business
1+1=3になる世界
matsuzaka01
0
160
AIにタスク管理 されてみた
hirado_ns
0
140
三井物産グループのデジタル証券~文京区・世田谷区レジデンス~徹底解説セミナー
c0rp_mdm
PRO
0
1.3k
税理士法人チェスター_事務所紹介資料
mabhr
0
640
【APTO】Company Deck(2026年4月)
recruit_
0
1.2k
アッテル会社紹介資料/culture deck
attelu
11
16k
【理学療法士・主任ケアマネの方急募】 入職祝い金 一律10万円支給キャンペーン
takanona25
0
110
(5枚)法人営業のキーパーソンを特定する方法 予材管理で最も重要なラインコントロール
nyattx
PRO
1
640
【エンジニア職】中途採用向け会社説明資料(テックファーム株式会社)
techfirm
0
7.1k
Crisp Code inc.|コーポレート・サービス紹介 - Corporate & Services Introduction
so_kotani
0
480
【ラクス】新卒採用
rakus_career
0
75k
Claude × Linear で代謝する組織をつくろう
nagatsu
0
1.5k
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Making Projects Easy
brettharned
120
6.6k
Paper Plane (Part 1)
katiecoart
PRO
0
6.9k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
The Curse of the Amulet
leimatthew05
1
12k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
260
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
220
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
110
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
How to make the Groovebox
asonas
2
2.1k
Git: the NoSQL Database
bkeepers
PRO
432
67k
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クラスタを制御す るアプリを作ろう