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
84
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
930
Amazon EKS Overview and Updates
shin5ok
0
140
コンテナ実践入門
shin5ok
0
77
AWS Partner Champion Members コンテナ編
shin5ok
0
82
AKSでマイクロサービス Bootcamp
shin5ok
0
170
Kubernetes has come on Azure / デモでわかるAKS
shin5ok
0
370
Azureで学ぶ 実践Kubernetes
shin5ok
3
2.1k
Azureで学ぶ 実践Kubernetes ハンズオン用資料
shin5ok
2
140
Azure コンテナプラットフォーム クイックツアー
shin5ok
0
160
Other Decks in Technology
See All in Technology
なんで私に登壇依頼が?! ~頼られるエンジニアになるためには~ /
mixi_engineers
PRO
2
190
MongoDB Atlas Vectorsearchではじめる生成AIアプリ開発
chie8842
3
500
沒想過的前端錯誤處理可能比你有做的還多
line_developers_tw
PRO
0
1.5k
Tohoku.Tech #1 「Cursorを使ったRaspberry Piの開発」by ねこまた
jun2882
0
250
チーム単位で保守性を高める:独自指標と向上にむけた実践
tarappo
0
290
KubeCon EU 2024 : Knative Maintainers Session
salaboy
0
360
マイクロサービス環境におけるDB戦略 in DMMプラットフォーム
pospome
11
3k
20240321_生成AI時代のDevOps
kzkmaeda
2
600
統計的学習理論読み Chapter 1
kmatsui
2
440
長文から長文を生成するLLMツールをオープンソースで作ってみた。
tomohisa
2
140
期待しすぎずに取り組む両面 TypeScript
shozawa
2
260
複数の LLM モデルを扱う上で直面した辛みまとめ
kazuyaseki
1
200
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
288
19k
Automating Front-end Workflow
addyosmani
1353
200k
Large-scale JavaScript Application Architecture
addyosmani
501
110k
What the flash - Photography Introduction
edds
64
11k
Faster Mobile Websites
deanohume
296
30k
Fashionably flexible responsive web design (full day workshop)
malarkey
397
65k
How to name files
jennybc
62
92k
BBQ
matthewcrist
78
8.7k
The Illustrated Children's Guide to Kubernetes
chrisshort
28
46k
Infographics Made Easy
chrislema
237
18k
Git: the NoSQL Database
bkeepers
PRO
421
63k
What’s in a name? Adding method to the madness
productmarketing
PRO
14
2.6k
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