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
Micro Service with AKS vol.2
Search
shin5ok
January 27, 2018
Technology
0
110
Micro Service with AKS vol.2
マイクロサービス基盤として使うAKS(kubernetes)
kubernetes未経験者を対象に、まずはアプリケーションを動かして体感しながら
特徴や注意点を学びます
shin5ok
January 27, 2018
Tweet
Share
More Decks by shin5ok
See All by shin5ok
Amazon EKS Quick Dive
shin5ok
1
1k
Amazon EKS Overview and Updates
shin5ok
0
220
コンテナ実践入門
shin5ok
0
140
AWS Partner Champion Members コンテナ編
shin5ok
0
93
AKSでマイクロサービス Bootcamp
shin5ok
0
190
Kubernetes has come on Azure / デモでわかるAKS
shin5ok
0
430
Azureで学ぶ 実践Kubernetes
shin5ok
3
2.4k
Azureで学ぶ 実践Kubernetes ハンズオン用資料
shin5ok
2
160
Azure コンテナプラットフォーム クイックツアー
shin5ok
0
180
Other Decks in Technology
See All in Technology
生まれ変わった AWS Security Hub (Preview) を紹介 #reInforce_osaka / reInforce New Security Hub
masahirokawahara
0
260
Github Copilot エージェントモードで試してみた
ochtum
0
110
Javaで作る RAGを活用した Q&Aアプリケーション
recruitengineers
PRO
1
120
第9回情シス転職ミートアップ_テックタッチ株式会社
forester3003
0
260
Liquid Glass革新とSwiftUI/UIKit進化
fumiyasac0921
0
250
【PHPカンファレンス 2025】PHPを愛するひとに伝えたい PHPとキャリアの話
tenshoku_draft
0
120
"サービスチーム" での技術選定 / Making Technology Decisions for the Service Team
kaminashi
1
190
SpringBoot x TestContainerで実現するポータブル自動結合テスト
demaecan
0
100
生成AIで小説を書くためにプロンプトの制約や原則について学ぶ / prompt-engineering-for-ai-fiction
nwiizo
4
2.7k
ドメイン特化なCLIPモデルとデータセットの紹介
tattaka
1
200
20250625 Snowflake Summit 2025活用事例 レポート / Nowcast Snowflake Summit 2025 Case Study Report
kkuv
1
340
プロダクトエンジニアリング組織への歩み、その現在地 / Our journey to becoming a product engineering organization
hiro_torii
0
130
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
24
1.7k
4 Signs Your Business is Dying
shpigford
184
22k
Testing 201, or: Great Expectations
jmmastey
42
7.5k
Bash Introduction
62gerente
614
210k
Making the Leap to Tech Lead
cromwellryan
134
9.4k
Gamification - CAS2011
davidbonilla
81
5.3k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.5k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Reflections from 52 weeks, 52 projects
jeffersonlam
351
20k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Designing Experiences People Love
moore
142
24k
Transcript
None
None
None
None
None
None
None
None
None
None
None
None
Dockerデーモン アプリ3 アプリ1 アプリ2
アプリ1 アプリ2 アプリ3 アプリ6 アプリ4 アプリ5 アプリ6 アプリ9 アプリ8 アプリ10
Dockerデーモン Dockerデーモン Dockerデーモン アプリ7
None
アプリ1 アプリ2 アプリ3 アプリ6 アプリ4 アプリ5 アプリ6 アプリ9 アプリ8 アプリ10
Dockerデーモン Dockerデーモン アプリ7
None
None
None
https://octoverse.github.com/
https://kubernetes.io/
None
None
None
None
# なにも動いていないことを確認 shell > kubectl get pods # nginx公式1.13.5-alpineを取得して、mynginxという名前で実行 shell
> kubectl run mynginx --image=nginx:1.13.5-alpine # mynginxが動いていることを確認する shell > kubectl get pods NAME READY STATUS RESTARTS AGE mynginx-3071068301-pbvnz 1/1 Running 0 1h # IPを設定して公開、IPを確認する shell > kubectl expose deploy mynginx --port=80 --type=LoadBalancer shell > kubectl get services
None
None
https://kubernetes.io/docs/tutorials/object-management-kubectl/object-management/ 管理手法 操作対象 推奨環境 学習コスト 主なツール 命令的コマンド 動作中のオブジェクト 開発 低い
kubectl 等 命令的設定ファイル ファイル プロダクション 普通 エディタ Git 宣言的設定ファイル ディレクトリ ファイル プロダクション 高い エディタ Git
None
None
None
None
None
None
None
None
None
shell > git clone https://
[email protected]
/shkawan/docker-appsample.git
# Dockerhub上のサンプルアプリを取得して実行 shell > kubectl run myappsample --image=shkawan/appsample:v3.00 --record #
サンプルアプリが動いていることを確認する shell > kubectl get pods # IPを設定して公開、IPを確認する shell > kubectl expose deploy myappsample --port=80 --type=LoadBalancer shell > kubectl get services
shell > kubectl scale --replicas=5 deployment myappsample # サンプルアプリのレプリカが増えていることを確認する shell
> kubectl get pods shell > kubectl set image deployment myappsample myappsample=shkawan/appsample:v3.10 # サンプルアプリのPodにローリングアップデートがかかっていることを確認する shell > kubectl get pods --watch
Deployment Service Replicaset Pods Pods Pods Pods Pods kube-proxy API
Server
None
None
None
shell > MONGODB_URI=外部のMONGODBを参照するURI shell > kubectl set env deploy myappsample
MONGODB_URI=$MONGODB_URI
None
# まず AKSの名前、リソースグループの名前、deployするリージョンを決めます shell > AKS_NAME=shkawan-aks shell > AKS_RESOURCE_GROUP=$AKS_NAME shell
> AKS_LOCATION=westus2 # 準備 shell > az login shell > az group create -n $AKS_NAME -l $AKS_LOCATION # 1発 deploy shell > az aks create -n $AKS_NAME -g $AKS_RESOURCE_GROUP -l $AKS_LOCATION
'MC_{リソースグループ名}_{AKS名}_{リージョン名}' のリソースグループが自動生成 例: MC_shkawan-aks5_shkawan-aks5_westeurope
# kubectlコマンドのインストール shell > az aks install-cli # 資格情報の取得 shell
> az aks get-credential -g $RESOURCE_GROUP -n $AKS_NAME shell > kubectl version # 補完を有効に shell > echo "source <(kubectl completion bash)" >> ~/.bashrc shell > source ~/.bashrc
# 現在のノード数を確認 # Azureで確認 shell > az aks show -n
$AKS_NAME -g $AKS_RESOURCE_GROUP | jq .properties.agentPoolProfiles # k8s上での確認 shell > kubectl get nodes # コマンド一発 shell > az aks scale -n $AKS_NAME -g $AKS_RESOURCE_GROUP --node-count 5 # Azure上、k8s上で確認
# 現在のバージョンと、アップグレード可能なバージョンを確認 shell > az aks get-versions -n $AKS_NAME -g
$AKS_RESOURCE_GROUP -o table shell > az aks upgrade --kubernetes-version 1.8.1 -g $AKS_RESOURCE_GROUP -n $AKS_NAME
None
None
None
None
None
SSL Gateway用 × 2 アプリ表示用 × 3 通知用 × 2
コメント用 × 2 Cosmos DB Log Analytics
None
SSL Gateway用 × 2 アプリ表示用 × 3 通知用 × 2
コメント用 × 2 Cosmos DB Log Analytics Immutable Immutable Immutable Immutable
SSL Gateway用 × 2 アプリ表示用 × 4 通知用 × 2
コメント用 × 2 Cosmos DB Log Analytics
None
https://docs.microsoft.com/ja-jp/dotnet/standard/microservices-architecture/multi-container-microservice-net-applications/microservice-application-
None
None
• API Gateway • Service Registry / Service Discovery •
Circuit Breaker • Polyglot Persistence • Command Query Responsibility Segregation (CQRS) • Tolerant Reader • Chained Services • Asynchronous Messaging • Service Instantiation • Consumer-Driven Contracts • Domain Events
1つのコードベースと複数のデプロイ 依存関係の宣言と、分離 設定を環境変数に格納 バックエンドサービスはアタッチした リソースとして扱う ビルド、リリース、実行のステージを分離 アプリケーションを1つ以上の ステートレスなプロセスとして実行する ポートバインディングを通して サービスを公開する
プロセスモデルにより スケールアウトする 高速な起動と グレースフルシャットダウン 開発、ステージング、本番環境を できるだけ一致させる ログをイベントストリームとして扱う 管理タスクは1回限りのプロセスとして扱う
None
None
None
マイクロサービスのドメイン境界/サービス分割例 https://docs.microsoft.com/ja-jp/dotnet/standard/microservices-architecture/architect-microservice-container-applications/identify-microservice-domain- model-boundaries
None
None