Why microservices? メルペイ 複数 サービスを短期間で立ち上げるため Focus on single service 各マイクロサービス 機能に集中して開発 Independent releases 独立した開発・リリース サイクル Team independence 組織を拡大しながら 複数 機能を同時に開発
アーキテクチャ API Gateway Authority API Service X API Service Y Google Cloud Load Balancer Service A Service B Google Kubernetes Engine Service C Web Service Z Cloud Spanner Project A Cloud Spanner Cloud Pub/Sub Project B Project GKE
API Gateway Authority API Service X API Service Y Google Cloud Load Balancer Service A Service B Google Kubernetes Engine Service C Web Service Z Cloud Spanner Project A Cloud Spanner Cloud Pub/Sub Project B Project GKE 共通 GKEクラスタ 3 1 2 個別 Project レイヤーアーキテクチャ
マイクロサービス on Google Kubernetes Engine すべて マイクロサービスが同じClusterに乗っている - Cluster自体 Platform Teamが構築・運用 - Namespace内を各チームが開発・運用 Google Kubernetes Engine Namespace: service-a Container A Container A Container A Namespace: service-b Container A Container A Container B
マイクロサービス 初期化 microservices-starter-kit という仕組みで自動化 ● GCP Project 作成+Application用Service Account 作成、 開発者へ IAM権限 付与 ● Kubernetes Namespace 作成+必要なRBAC&Secret 設定 GCP project for GKE Centralized cluster Namespace: Service A Service A RBAC: Team A
Kubernetesリソース単体 デプロイ Manifest 単体をCircleCIからデプロイ - Job、Horizontal Pod Autoscalerなど YAML CircleCI Google Kubernetes Engine yaml GitHub Namespace: service-a Container A Container A Container A Namespace: service-b Container A Container A Container B
Microservicesアプリケーション デプロイ 必要なYAMLとImageを指定してSpinnaker経由でデプロイ CI Google Kubernetes Engine yaml Namespace: service-a Container A Container A Container A Namespace: service-b Container A Container A Container B Cloud Build Container Registry code CI
マイクロサービス 運用体制 マイクロサービスで 各チームが担当マイクロサービスを運用 ● 元から運用経験があるエンジニア 多くない Google Kubernetes Engine Container A Container A Container A Cloud Spanner Project A Container A Container A Container B Cloud Spanner Project B Cloud Pub/Sub
[3] Ingress を追加したら既存 Ingressが 壊れた 原因 ● 2つ Ingress 設定を元に 同じ HTTPS proxy を交互に更新 していた ● Namespace名+Ingress名 先頭55文字で区別しているため、 長くて似た名前で作っていたIngressがぶつかっていた ● 実 ドキュメントに書いてある ○ The total length of the namespace and name of an Ingress must not exceed 55 characters.