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
210
コンテナ実践入門
shin5ok
0
130
AWS Partner Champion Members コンテナ編
shin5ok
0
92
AKSでマイクロサービス Bootcamp
shin5ok
0
190
Kubernetes has come on Azure / デモでわかるAKS
shin5ok
0
430
Azureで学ぶ 実践Kubernetes
shin5ok
3
2.4k
Azureで学ぶ 実践Kubernetes ハンズオン用資料
shin5ok
2
150
Azure コンテナプラットフォーム クイックツアー
shin5ok
0
180
Other Decks in Technology
See All in Technology
ゴリラ.vim #36 ~ Vim x SNS ~ スポンサーセッション
yasunori0418
1
340
OSMnx Galleryの紹介
mopinfish
0
150
SmartHRの複数のチームにおけるMCPサーバーの活用事例と課題
yukisnow1823
2
1.1k
大事なのは、AIの精度だけじゃない!〜1円のズレも許されない経理領域とAI〜
jun_nemoto
10
5.1k
What's Next in OpenShift Q2 CY2025
redhatlivestreaming
1
770
KMP導⼊において、マネジャーとして考えた事
sansantech
PRO
1
210
プロジェクトマネジメント実践論|現役エンジニアが語る!~チームでモノづくりをする時のコツとは?~
mixi_engineers
PRO
3
180
Introduction to Bill One Development Engineer
sansan33
PRO
0
240
Zero Data Loss Autonomous Recovery Service サービス概要
oracle4engineer
PRO
2
7.2k
エンジニア幼年期の終わり
rebase_engineering
1
110
会社員しながら本を書いてきた知見の共有
sat
PRO
3
690
“新卒らしさ”を脱ぎ捨てて 〜1年を経て学んだこと〜
rebase_engineering
0
130
Featured
See All Featured
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
15
890
Agile that works and the tools we love
rasmusluckow
329
21k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Fontdeck: Realign not Redesign
paulrobertlloyd
84
5.5k
Making Projects Easy
brettharned
116
6.2k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.8k
How to Think Like a Performance Engineer
csswizardry
23
1.6k
Speed Design
sergeychernyshev
30
970
The Art of Programming - Codeland 2020
erikaheidi
54
13k
Building Adaptive Systems
keathley
41
2.6k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
106
19k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.3k
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