SlideShare une entreprise Scribd logo
1  sur  41
Slides for Azure Webinar: Kubernetes on Azure
<アジェンダ>
• マネージド Kubernetes サービス、 Azure Kubernetes Service (AKS)
• クラスタレスにコンテナアプリ実行を実現する Azure Container Instance(ACI)
• Open Service Broker API をベースに統一仕様で Azure PaaS サービスとの疎結合を実現する Open Service
Broker for Azure (OSBA)
• Kubernetes アプリ開発の自動化を支えるツール群
• モニタリングソリューション
※ Build 2018 の最新アップデート情報を含む
<ご参考>
Microsoft Build 2018
https://www.microsoft.com/en-us/build
Kubernetes (k8s)とは?
デファクト コンテナ オーケストレーター
ポータブル
Public, private, hybrid,
multi-cloud
拡張可能
Modular, pluggable,
hookable, composable
自己回復
Auto-placement, auto-
restart, auto-replication,
auto-scaling
Layer 1
Layer 2
Layer 3
Layer 4
Layer 5
Layer 6
Layer 7
参考: Gabe Monroy on Twitter: "Strata of the Container Ecosystem https://twitter.com/gabrtv/status/539805332432637952
https://kubernetes.io/
• ACS Engineで先行導入した機能を安定化
後にAKSに順次リリース
DC/OS、Docker Swarmもサポート
IaaSPaaS
Azure services
SQL Database
Redis Cache
CosmosDB
And more!
Partner services
OpenShift
Pivotal Cloud
Foundry
Docker Enterprise
Edition
Mesosphere
DC/OS
Azure
Azure
Container
Registry
(ACR)
OSBA
Azure Kubernetes
Service (AKS)
ACS
Engine
Batch
Azure Container
Instances (ACI)
Azure Virtual
Machines
Virtual Machine
Scale Sets
(VMSS)
Service Fabric
Virtual kubelet
App Service
AKSの主な特徴
https://azure.microsoft.com/en-us/support/legal/sla/kubernetes-service/v1_0/
As a free service, AKS does not offer a financially-backed
service level agreement. We will strive to attain at least
99.5% availability for the Kubernetes API server. The
availability of the agent nodes in your cluster is covered
by the Virtual Machines SLA. Please see the Virtual
Machines SLA for more details.
Setup High-AvailabilityKubernetes Masters
https://kubernetes.io/docs/tasks/administer-cluster/highly-available-master/#implementation-notes
例えば、次のオペレーションもこんなに簡単
az aks scale –name mycluster –resource-group rg-aks --node-count 4
az aks upgrade –name mycluster –resource-group rg-aks --kubernetes-version
1.9.6
https://docs.microsoft.com/en-us/azure/aks/intro-kubernetes
• Azureポータル、Azure CLIコマンド、ARMテンプレートに加えてTerraformを利用
したクラスタ構築も可能
• デフォルトでK8sのRoll-based Access Control (RBAC) 設定可能
• Azure ADベースのアクセス制御も可能 (Preview)
• クラスタのスケーリング、アップグレード
• HTTPアプリケーションルーティング (外向けDNS名とIngressControllerが自動設定)
• GPU VMノード利用可能
• VNET連携 - Advanced Networking設定 (CNI Plugin利用) により新規VNET、または
既存のVNETへのクラスタのデプロイが可能。Podが他のピアリング接続された
VNETと接続可能。またExpressRouteやVPN接続を通じてオンプレのサービスと接
続可能
Azure Container Instances (ACI)
クラスタフリー &サーバレス コンテナサービス
タスク(コンテナの実行単位)に割り当てたvCPUとメモリの量に応じて秒単位での
課金でコンテナを実行することができる技術。
サーバ / ノードを意識することなく、またクラスタの管理が不要であるため利用
者はインフラではなくコンテナ アプリケーションに集中できる。
Kubernetesが複数コンテナ間の連携を要する、ある程度予測可能で長く起動して
いるワークロードが向いているのに対して、このサービスはよりシンプルで、一
時的、かつバースト型のワークロードの実行が向いている
IaaSPaaS
Azure services
SQL Database
Redis Cache
CosmosDB
And more!
Partner services
OpenShift
Pivotal Cloud
Foundry
Docker Enterprise
Edition
Mesosphere
DC/OS
Azure
Azure
Container
Registry
(ACR)
OSBA
Azure Kubernetes
Service (AKS)
ACS
Engine
Batch
Azure Container
Instances (ACI)
Azure Virtual
Machines
Virtual Machine
Scale Sets
(VMSS)
Service Fabric
Virtual kubelet
App Service
az container create 
-g aci_grp 
--name nginx 
--image library/nginx 
--ip-address public 
–cpu 2 --memory 5
シングルコマンドで実行可能なクラスタフリーコンテナ環境
PREVIEW
Kubernetes
control pane
Application
architect
Infrastructure
architect
Azure Container Instances (ACI)
ACI
Connector
Pod
Pod Pod
Pod
Pod Pod
Pod
Pod Pod
Pod
Pod Pod
VM VM
VM VM
Deployment/
tasks
Pod Pod Pod Pod Pod
Pod Pod Pod Pod Pod
Pod Pod Pod Pod Pod
Pod Pod Pod Pod Pod
Pod Pod Pod Pod Pod
WasteWaste
WasteWaste PodPod
PodPod
ACI Connector for Kubernetesを使うことでKubernetesクラスタがコンテナをACIに直
接展開できるようになる。開発者は必要に応じてVMとACIを混在させることができ
るようになる
PREVIEW
https://github.com/virtual-kubelet/virtual-kubelet
Kubetetの仮想実装 – 汎用的にKubernetesクラスターから外部サービスをプラグイン
として利用可能にする仕組み
アプリケーションが外部サービスとの連携をしやすくする仕組み
 Open Service Broker API : プラットフォーム非依存でサービス利用可能にする
 Service Catalog : KubernetesとOpen Service Broker APIを連携可能にする
IaaSPaaS
Azure services
SQL Database
Redis Cache
CosmosDB
And more!
Partner services
OpenShift
Pivotal Cloud
Foundry
Docker Enterprise
Edition
Mesosphere
DC/OS
Azure
Azure
Container
Registry
(ACR)
OSBA
Azure Kubernetes
Service (AKS)
ACS
Engine
Batch
Azure Container
Instances (ACI)
Azure Virtual
Machines
Virtual Machine
Scale Sets
(VMSS)
Service Fabric
Virtual kubelet
App Service
https://www.openservicebrokerapi.org/
Open Service Broker API – v2.13
Cloud Foundry
Cloud
Controller
https://www.openservicebrokerapi.org/
Any Platform
プラットフォーム
非依存で利用可能な
API仕様
Secret
Service Catalog Architecture
https://kubernetes.io/docs/concepts/service-catalog/
Service Catalog Design
https://github.com/kubernetes-incubator/service-
catalog/blob/master/docs/design.md
Cloud Foundry
Cloud
Controller
Any Platform
Kubernetes
+
Service CatalogService Catalog
パッケージ管理ツール
https://github.com/Azure/open-service-broker-azure
1stパーティのプライベートコンテナレジストリ管理サービス
オープンソースのDocker
CLI ツールで
利用可能
ジオレプリケーション
すべてのタイプの
コンテナイメージを管理
IaaSPaaS
Azure services
SQL Database
Redis Cache
CosmosDB
And more!
Partner services
OpenShift
Pivotal Cloud
Foundry
Docker Enterprise
Edition
Mesosphere
DC/OS
Azure
Azure
Container
Registry
(ACR)
OSBA
Azure Kubernetes
Service (AKS)
ACS
Engine
Batch
Azure Container
Instances (ACI)
Azure Virtual
Machines
Virtual Machine
Scale Sets
(VMSS)
Service Fabric
Virtual kubelet
App Service
• コンテナイメージをクラウドでビルドする機能
• レジストリ側でのビルド → 高速プッシュ&デプロイメントが可能
Quick Build Image設定チュートリアル
自動イメージビルド設定チュートリアル
自動イメージビルド設定(ベースイメージ更新トリガー)チュートリアル
Helmとは?
• Kubernetesアプリのパッケージ管理とデプロイメントを行うツール
• Linuxにおけるapt-getやyum、Mac OSにおけるHomebrewのような位置付け
• LinuxにおけるDepsやRPM にあたるHelmパッケージのことをChartsと呼ぶ
https://helm.sh/
Helmの構成要素
• クライアント ( Helm ): 利用者のローカルマシンやCI/CDパイプラインにて利用
• サーバ ( tiller ): Kubernetesクラスタにて実際のデプロイメントを行う
Chartsレポジトリ
https://github.com/kubernetes/charts
helm install
-f config.yaml
<package> …
helm upgrade
-f config.yaml
<release-name> …
helm rollback
<release-name>
<revision>
• UIからとても簡単にAKSを含むAzureサービスへのCI/CD環境を構築可能
• Azureサービスのプロビジョニング、Gitコードレポジトリ、App Insightsとのイン
テグレーション、CI/CDパイプラインの自動設定、DevOps Projectダッシュボード
からコードコミット・ビルド・デプロイの状況を確認可能
• AKSの場合: VSTS (ビルド・リリースパイプライン)とACR(ジレストリ)間処理を
行い、最終的にHelmチャートにパッケージングしてAKSクラスタにデプロイ
https://docs.microsoft.com/en-us/azure/devops-project/
https://azure.microsoft.com/ja-jp/blog/azure-devops-project-public-preview/
• Visual Studio Kubernetes Tool = Visual Studio拡張機能
• “Container Application for Kubernetes”プロジェクトにおいてツールが自動的に
DockerfileとHelmチャートを生成し、ツールからAKSにデプロイ可能
https://blogs.msdn.microsoft.com/visualstudio/2018/06/08/preview-of-visual-studio-kubernetes-tools/
https://docs.microsoft.com/en-us/azure/monitoring/monitoring-container-health
https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-containers
クラスタ作成時にAzureポータルから、
もしくはARMテンプレートで有効化設定
クラスタ内全ノード、コントローラー、コンテナの
ステータスを確認可能(メトリック・ログ両方」)
各Pod, Containerにドリルダウン
でLog Analyticsでログ閲覧可能
Combine multiple Kubernetes resources in
one versioned unit (a chart)
Templates provide default behavior and ability
to override
Enables lifecycle operations like upgrade
Helm repos enable easy deployment of pre-
built apps

Contenu connexe

Plus de Yoichi Kawasaki

Plus de Yoichi Kawasaki (13)

コンテナ&サーバーレス:トレンドの考察と少し先の未来の展望
コンテナ&サーバーレス:トレンドの考察と少し先の未来の展望コンテナ&サーバーレス:トレンドの考察と少し先の未来の展望
コンテナ&サーバーレス:トレンドの考察と少し先の未来の展望
 
アプリケーション開発者のためのAzure Databricks入門
アプリケーション開発者のためのAzure Databricks入門アプリケーション開発者のためのAzure Databricks入門
アプリケーション開発者のためのAzure Databricks入門
 
Azure Search 言語処理関連機能 〜 アナライザー、検索クエリー、辞書、& ランキング, etc
Azure Search 言語処理関連機能 〜 アナライザー、検索クエリー、辞書、& ランキング, etcAzure Search 言語処理関連機能 〜 アナライザー、検索クエリー、辞書、& ランキング, etc
Azure Search 言語処理関連機能 〜 アナライザー、検索クエリー、辞書、& ランキング, etc
 
Kubernetes x PaaS – コンテナアプリケーションのNoOpsへの挑戦
Kubernetes x PaaS – コンテナアプリケーションのNoOpsへの挑戦Kubernetes x PaaS – コンテナアプリケーションのNoOpsへの挑戦
Kubernetes x PaaS – コンテナアプリケーションのNoOpsへの挑戦
 
Azure Functions&Logic Appではじめるサーバレスアプリケーション開発 - 応用編 -
Azure Functions&Logic Appではじめるサーバレスアプリケーション開発 - 応用編 -Azure Functions&Logic Appではじめるサーバレスアプリケーション開発 - 応用編 -
Azure Functions&Logic Appではじめるサーバレスアプリケーション開発 - 応用編 -
 
Azure Functions&Logic Appではじめるサーバレスアプリケーション開発 - 入門編 -
Azure Functions&Logic Appではじめるサーバレスアプリケーション開発 - 入門編 -Azure Functions&Logic Appではじめるサーバレスアプリケーション開発 - 入門編 -
Azure Functions&Logic Appではじめるサーバレスアプリケーション開発 - 入門編 -
 
Web App for Containers + Cosmos DBで コンテナ対応したMEANアプリを作ろう!
Web App for Containers + Cosmos DBで コンテナ対応したMEANアプリを作ろう!Web App for Containers + Cosmos DBで コンテナ対応したMEANアプリを作ろう!
Web App for Containers + Cosmos DBで コンテナ対応したMEANアプリを作ろう!
 
15分でお届けする Elastic Stack on Azure 設計・構築ノウハウ
15分でお届けする Elastic Stack on Azure 設計・構築ノウハウ15分でお届けする Elastic Stack on Azure 設計・構築ノウハウ
15分でお届けする Elastic Stack on Azure 設計・構築ノウハウ
 
Azure PaaSを活用したモダン E コマースソリューションの構築方法
Azure PaaSを活用したモダン E コマースソリューションの構築方法Azure PaaSを活用したモダン E コマースソリューションの構築方法
Azure PaaSを活用したモダン E コマースソリューションの構築方法
 
PythonによるAzureサーバレスアプリケーション開発 / Serverless Application Development with Python
PythonによるAzureサーバレスアプリケーション開発 / Serverless Application Development with PythonPythonによるAzureサーバレスアプリケーション開発 / Serverless Application Development with Python
PythonによるAzureサーバレスアプリケーション開発 / Serverless Application Development with Python
 
Web App for Containers + MySQLでコンテナ対応したPHPアプリを作ろう!
Web App for Containers + MySQLでコンテナ対応したPHPアプリを作ろう! Web App for Containers + MySQLでコンテナ対応したPHPアプリを作ろう!
Web App for Containers + MySQLでコンテナ対応したPHPアプリを作ろう!
 
Web App for Containers + MySQLでコンテナ対応したRailsアプリを作ろう!
Web App for Containers + MySQLでコンテナ対応したRailsアプリを作ろう!Web App for Containers + MySQLでコンテナ対応したRailsアプリを作ろう!
Web App for Containers + MySQLでコンテナ対応したRailsアプリを作ろう!
 
Azure サービスを活用して作るフルマネージドな全文検索アプリケーション
Azure サービスを活用して作るフルマネージドな全文検索アプリケーションAzure サービスを活用して作るフルマネージドな全文検索アプリケーション
Azure サービスを活用して作るフルマネージドな全文検索アプリケーション
 

一挙紹介: Kubernetes on Azureで実現する快適なマイクロサービス環境

Notes de l'éditeur

  1. VM SLA: https://azure.microsoft.com/en-us/support/legal/sla/virtual-machines/v1_8/
  2. K8s属性データはetcdに保存されているので、ここのバックアップは非常に重要
  3. K8S: RBAC(Role-based access control)とは、役割ベースのアクセス制御機能。 RBACリソースは4つのリソースがある。RoleリソースとClusterRoleリソースとRoleBindingリソースとClusterRoleBindingリソース GPU: NCシリーズでのGPUクラスタ。GPUは特別なハードをつかっているため高いのとリージョナルの利用可能については確認が必要 https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes-gpu これまでのネットワークは一律 Basic (Kubenet)でフラットなネットワーク構成しか組めなかった Advanced Networkの特徴については https://docs.microsoft.com/en-us/azure/aks/networking-overview#advanced-networking-features 全てのPodがVNET内のIPが振られるのでクラスタ内のPODだけじゃなくてVNET内の他のノードとの通信が可能
  4. https://docs.microsoft.com/ja-jp/azure/container-instances/container-instances-overview コンテナー1つから使えるマネージドサービス ユーザーはアプリに集中 秒単位課金 起動が秒速なコンテナーならでは 単独でも、組み合わせても 今後Azureの各サービスの基盤として使われる可能性大 今できること - Run Linux and Windows containers - Custom CPU/memory (up to 4 CPU/14 GB memory) - Expose containers via public IP - Mount storage volumes - Set environment variables and pass secrets - Set restart policy - Override the command line ロードマップ - Provide most standard container capabilities Attach to an existing container Copy files into/out of running containers Enable ACI containers to do most things that VMs can do in Azure Networking: Join a private vnet, sit behind an internal or external load balancer Storage: Mount managed disks (Azure files is already available) Invest in ACI Connector for more complex applications Autoscaling, HA, rolling upgrades, load balancing, etc. will all be easier with an orchestrator Developer tooling will also primarily target the orchestrator layer Serverless CI Builds with Cake and Azure Container Instances https://markheath.net/post/serverless-ci-with-cake-and-aci
  5. echo "deploy the Facial Recognition application that consists of a frontend, a backend, and a set of image recognizers." helm install charts/fr-demo --name demo echo "Deploy the ACI connector : Replace <myResourceGroupmy>, <myK8sCluster> with yours in previous steps and run following command" az aks install-connector --resource-group RG-aks --name myAKSCluster --connector-name myaciconnector # The connector has been deployed and with a kubectl get nodes you can see that the ACI Connector is a new node in your cluster. Now scale up the image recognizer to 10 using the following command kubectl scale deploy demo-fr-ir-aci --replicas 10
  6.  This allows the nodes to be backed by other services like ACI, AWS Fargate, Hyper.sh, IoT Edge etc. 外部プラグインとして利用可能 UPDATE: 6/11/2018 Azure Container Instances supports multiple new features in the release of the June API 01-06-2018: Deploy multi-container groups by using simple YAML configurations from Azure CLI 2.0. You can also export the YAML from existing container groups to save and edit configurations. az container create --resource-group MyResourceGroup --name myContainerGroup -f myconfiguraiton.yaml az container export --resource-group MyResourceGroup --name myContainerGroup -f exportedconfiguration.yaml Pass secrets safely as environment variables that can only be accessed from within your container by utilizing secure values. Set up liveness probes for your containers so they restart when specific functionality isn't working. Query your container logs from Azure Log Analytics by passing in an OMS workspaceId.
  7. https://www.slideshare.net/jacopen/cfopen-service-broker
  8. https://www.slideshare.net/makingx/open-service-broker-apikubernetes-service-catalog-k8sjp-90024385
  9. 25
  10. レジストリサービス: Docker Hub, Docker Registry, ACR ACR = オープンソースの Docker Registry 2.0 に基づいた、管理された Docker レジストリ サービス コンテナイメージをネットワーク的に近い場所に保持可能 コンテナイメージをプライベートで保管 ジオレプリケーション: 1 つのレジストリ (contoso.azurecr.io) を管理. ネットワーク上の近い場所での高速で信頼性の高いローカル イメージのプルを維持しながら、単一の管理プレーンによるメリット。他リージョンからのPULLはegressがかかるのでマルチリージョンいレプリカを作りたい Azure Active Directory 認証 Open Source CLI 互換(Docker CLIで)
  11. ビルドするとビルドIDが振られる。プロビジョニングはコンテナ名:ビルドID指定で行うことができる
  12. https://thinkit.co.jp/article/13414
  13. 両方とも these metrics are automatically collected for you using a containerized version of the OMS Agent for Linux and stored in your Log Analytics workspace ただし Log Analytics Container SolutionはLogAnalyticsのポータルより閲覧、Azure Monitorは専用Azure Monitorダッシュボードで閲覧。見え方は違います よりK8Sに特化していて見やすいのはAzure Monitor Container Health
  14. After monitoring is enabled, it can take around 15 minutes before you are able to see operational data for the cluster.
  15. 41