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
Kubernetes コマンド入門
Search
Kyohei Mizumoto
February 08, 2019
Technology
0
34
Kubernetes コマンド入門
Kyohei Mizumoto
February 08, 2019
Tweet
Share
More Decks by Kyohei Mizumoto
See All by Kyohei Mizumoto
CTFのためのKubernetes入門
kyohmizu
2
860
クラウドネイティブ環境の脅威モデリング
kyohmizu
2
640
コンテナサプライチェーンセキュリティ
kyohmizu
2
330
サイバーセキュリティの最新動向:脅威と対策
kyohmizu
1
340
コンテナセキュリティの基本と脅威への対策
kyohmizu
4
1.9k
安全な Kubernetes 環境を目指して
kyohmizu
4
1.2k
Unlocking Cloud Native Security
kyohmizu
5
1.4k
コンテナ × セキュリティ × AWS
kyohmizu
11
4.1k
コンテナセキュリティ
kyohmizu
10
4.3k
Other Decks in Technology
See All in Technology
生成AI時代のセキュアコーディングとDevSecOps
yuriemori
0
140
RDS の負荷が高い場合に AWS で取りうる具体策 N 連発/a-series-of-specific-countermeasures-available-on-aws-when-rds-is-under-high-load
emiki
7
4.3k
Kubernetes self-healing of your workload
hwchiu
0
270
Azureコストと向き合った、4年半のリアル / Four and a half years of dealing with Azure costs
aeonpeople
1
230
OAuthからOIDCへ ― 認可の仕組みが認証に拡張されるまで
yamatai1212
0
140
データ戦略部門 紹介資料
sansan33
PRO
1
3.8k
Bill One 開発エンジニア 紹介資料
sansan33
PRO
4
14k
SCONE - 動画配信の帯域を最適化する新プロトコル
kazuho
1
230
AI-Readyを目指した非構造化データのメダリオンアーキテクチャ
r_miura
1
220
AI時代におけるデータの重要性 ~データマネジメントの第一歩~
ryoichi_ota
0
700
Dylib Hijacking on macOS: Dead or Alive?
patrickwardle
0
410
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
940
Featured
See All Featured
RailsConf 2023
tenderlove
30
1.3k
For a Future-Friendly Web
brad_frost
180
10k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
140
34k
How to train your dragon (web standard)
notwaldorf
97
6.3k
What's in a price? How to price your products and services
michaelherold
246
12k
Designing Experiences People Love
moore
142
24k
Making the Leap to Tech Lead
cromwellryan
135
9.6k
How GitHub (no longer) Works
holman
315
140k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
630
Product Roadmaps are Hard
iamctodd
PRO
54
11k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Building Flexible Design Systems
yeseniaperezcruz
329
39k
Transcript
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 1/26 Kubernetes コマンド⼊⾨ 1 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 2/26 Kyohei Mizumoto(@kyohmizu) C# Software Engineer
Interests Docker/Kubernetes Go Security whoami 2 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 3/26 対象者 Kubernetes未経験者 3 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 4/26 kubectl 4 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 5/26 kubectl︖ Kubernetesのコマンドを実⾏するCLIツール 5 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 6/26 シンタックス kubectl [command] [TYPE] [NAME]
[flags] 使い⽅がわからないものは --help で確認 6 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 7/26 kubectlコマンド apply config create delete
describe 7 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 8/26 kubectlコマンド exec get logs patch
replace 8 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 9/26 kubectlコマンド scale top version etc...
9 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 10/26 バージョン確認 $ kubectl version 10
/ 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 11/26 リソース作成 $ kubectl create -f
[リソース定義ファイル] 例 $ kubectl create -f sample.yaml 11 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 12/26 リソース差し替え $ kubectl replace -f
[リソース定義ファイル] 12 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 13/26 リソース更新 $ kubectl patch [リソースの種類]/[リソース名]
\ -p [更新後内容] 例 $ kubectl patch pod sample-pod -p \ '{"spec":{"containers":[{"name":"sample","image":"new image"}]}}' 13 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 14/26 リソース定義を適⽤ $ kubectl apply -f
[リソース定義ファイル] create, replace, patchを合わせたような機能 14 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 15/26 リソース削除 $ kubectl delete -f
[リソース定義ファイル] リソース名を指定した削除は⾏わない 15 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 16/26 リソース⼀覧を表⽰ $ kubectl get [リソースの種類]
リソース名指定で個別表⽰ -o wide で追加情報を表⽰ 例 $ kubectl get po,rs,deploy 16 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 17/26 コンテナ上でコマンドを実⾏ $ kubectl exec -it
[Pod名] [コマンド] 例 $ kubectl exec -it [Pod名] /bin/bash 17 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 18/26 ログの確認 $ kubectl logs [Pod名]
18 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 19/26 リソース消費量確認 $ kubectl top [pod
| node] 19 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 20/26 サイズを変更 $ kubectl scale --replicas=n
[リソースの種類]/[リソース名] スケールアウト、スケールイン 通常はマニフェストの修正を⾏う 例 $ kubectl scale --replicas=5 deploy/sample-deploy 20 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 21/26 リソース詳細を表⽰ $ kubectl describe [リソースの種類]
[リソース名] 状態、イベント、リビジョン等の確認 例 $ kubectl describe rs sample-rs 21 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 22/26 設定の変更 $ kubectl config [サブコマンド]
kubeconfigファイルを修正 22 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 23/26 デモ 23 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 24/26 参考書籍 24 / 26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 25/26 参考サイト 公式 https://kubernetes.io/docs/reference/kubectl/ 25 /
26
2019/3/28 Kubernetes コマンド⼊⾨ 127.0.0.1:5500/#26 26/26 Thank you! 26 / 26