0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

kubernetes入門 - Part3 - Kubernetesの基本4リソース

Posted at

イメージ

このイメージをすれば概要はだいたい分かります

image.png

基本の4つのリソース

項目 概要 構成 目的
Pod 最小単位 1つ以上のコンテナで構成 同一ノードで動作するアプリの管理
ReplicaSet クラスタ 1つ以上のPodで構成 信頼性の確保
Deployment デプロイ単位 1つ以上のReplicaSetで構成 コンテナのバージョンアップ、デプロイ時のダウンタイム制御
Service 外部からの接続単位 1つ以上のReplicaSetで構成 ロードバランシングなど外部からの接続を実現

yamlのテンプレート出力コマンド

一度 --dry-run -o yaml で雛形を出したら、それを元に編集して使いまわせます。

リソース コマンド 備考
Pod kubectl run my-pod --image=nginx --restart=Never --dry-run=client -o yaml
Deployment kubectl create deployment my-app --image=nginx --dry-run=client -o yaml --dry-run=client は「実際にはクラスタに反映しない」の意味
Service kubectl expose deployment my-app --port=80 --target-port=80 --type=ClusterIP --dry-run=client -o yaml
ConfigMap kubectl create configmap my-config --from-literal=key=val --dry-run=client -o yaml
Secret kubectl create secret generic my-secret --from-literal=key=val --dry-run=client -o yaml
ReplicaSet kubectl create で Pod をベースに作成 → 手動で書き換える
kubectl run my-rs-pod --image=nginx --restart=Never --dry-run=client -o yaml > my-replicaset.yaml
kind: Podkind: ReplicaSet
metadata.name, spec.template, spec.replicas を追加
spec.selector を手動で記述する必要あり
ReplicaSet 用のコマンドは無い
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?