SlideShare a Scribd company logo
Azure x Elastic x Terraform で
クラウドネイティブアプリケーションを
構築して監視する
鈴⽊ 章太郎
Elastic テクニカルプロダクトマーケティングマネージャー/エバンジェリスト
デジタル庁 プロジェクトマネージャー
Elastic
Technical Product Marketing
Manager/Evangelist
デジタル庁
プロジェクトマネージャー
元 Microsoft Technical Evangelist
Twitter : @shosuz
Shotaro Suzuki
l Elastic 概要
l Elastic Observability
l Elastic and HashiCorp
l Terraform による Azure Kubernetes Service クラスター
作成
l Elastic Cloud on Azure へのサンプルアプリのデプロイ
l Elastic x Azure 統合による Observability と APM の進化
l まとめ
アジェンダ
Elastic 概要
3 億 5,000 万以上のダウンロード、
12,000 以上の企業での採⽤
40 カ国以上で 2,000 ⼈の従業員
IPO 2018, NYSE: “ESTC”
2012 年設⽴
Elastic 会社概要
Distributed by design
About Elastic
世界の #1 データベース検索エンジン
(DB-Engines)
3 Solutions, 1 Stack, Deploy Anywhere
Elastic Stack
Kibana
Elasticsearch
Beats Logstash
Elastic エンタープライズサーチ Elastic セキュリティ
Elastic オブザーバビリティ
3 つのソリューション
SaaS
(AWS/Azure/GCP)
IaaS
(クラウド & オンプレ)
Elastic Cloud
on Kubernetes
Elastic Cloud Elastic Cloud
Enterprise
豊富なデプロイ選択肢
Kubernetes
(クラウド & オンプレ)
蓄積、検索、分析
可視化 & 管理
収集
Elastic Observability
マイクロ
サービス
コンテナ
CI / CD
オーケストレーション
サーバレス クラウド
ソフトウェアの開発⽅法とデリバリーは常に進化
開発チーム
運⽤:
ログ監視
可動性
応答時間
アップタイム
ツール
運⽤︓
インフラ監視
ウェブログ
アプリログ
データベース ログ
コンテナログ
ログツール
リアルユーザー監視
トランザクション
パフォーマンス監視
分散トレーシング
APM ツール
運⽤︓
サービス監視
コンテナ指標
ホスト指標
データベース指標
ネットワーク指標
ストレージ指標
メトリック
ツール
ビジネス KPI
ビジネスツール
ビジネス
チーム
現状 ー 典型的なオブザーバビリティのツール群
開発、運⽤、ビジネスチーム
Elastic のオブザーバビリティへのアプローチ
APM データ
アップタイム
データ
指標データ
ログデータ
ビジネス
データ
全ての運⽤にまつわるデータを、
⼀つの強⼒なデータストアに集約 - Elasticsearch
Elastic Observability
単⼀のオープンプラットフォームによる完全な可視性を
⼿頃な価格で提供し、
MTTR (データ・分析結果を得るまでの平均時間) をゼロに近づける
Application Performance Monitoring (APM)
• ログ、APM、インフラメトリックは監視の3⼤要素
• 3つの領域には重なり合う部分もあり相互に関連付ける際に
役⽴つ
• ログはエラーが⽣じた痕跡のみでエラーの理由までは⽰さない
• メトリックはサーバー上で CPU 使⽤量にスパイクがあったこと
を⽰すかもしれないが、何が原因だったかは⽰さない
• ログやメトリックは、インフラや複数のコンポーネントを扱う横断
的なデータ
• うまく組み合わせて活⽤すれば、はるかに広い範囲の問題を
解決できる可能性がある
• APM はメトリックとログのギャップに橋を架ける存在
Elastic Application Performance Monitoring
• マルチページ、シングルページ、双⽅のアプリで有効
• Node.js、Python、Ruby、.NET、 Java、Go、
PHP、Real User Monitoring(JS SPA)
• 対応⾔語のさらなる追加も予定
• Elastic がサポートする⾔語はこちら
• Jaeger や OpenTelemetry 等各種のオープン
スタンダードもサポート
• インストルメンテーション済みのアプリから Elastic
APM へ驚くほど簡単にデータを送れる
• 必要なモジュールが⾒つからなくても独⾃に開発も、
オープンソースコミュニティの成果物の活⽤も可能
• APM から応答時間ベース Machine Learning
ジョブを作成する機能もあり
Elastic and HashiCorp
Elastic and HashiCorp partner to bring
infrastructure-as-code to Elastic Cloud
https://www.elastic.co/jp/blog/elastic-hashicorp-partner-to-bring-infrastructure-as-code-to-elastic-cloud
Elastic社とHashiCorp 社が提携し
Elastic Cloud でInfrastructure-as-code を可能に
• Elastic Cloud ⽤ Terraform 検証済みプロバイダー
• Elastic Cloud
• Elastic Cloud Enterprise
• Elastic Cloud on Kubernetes
• Elastic Cloud Terraform プロバイダの使⽤
• 同じ⾃動化コードを使⽤してデプロイメントを実施可能
• オンプレミス or 全パブリッククラウド(AWS/Azure/GCP)で実⾏できる
• このプロバイダはベータ版 beta version がベース
• オートスケーリング autoscaling やデプロイメントエイリアスなどの Elastic Cloud の機能を活⽤できる
• 新しいデプロイメント拡張機能を利⽤して ARM64 デバイス上でプロバイダを実⾏できる
デプロイメントのオートスケーリング
• Terraform プロバイダを使⽤することにより、デプロイメントのトポロジーやデータ層の構成に
かかわらず、デプロイメントの⾃動スケーリングポリシーを制御および変更できる
• サイズを動的に拡張するデプロイメントを作成することで、デプロイメントのパフォーマンスと
信頼性を維持することができる
• リソースの使⽤量が増えると、リソースの容量も増える
デプロイメントエイリアス
• デプロイメントエンドポイントのエイリアス deployment endpoint alias を
作成
• インターネット経由で利⽤可能なユーザー指定の名前でデプロイメントにアクセスできる
• 変数と tfvars ファイルを使⽤したデプロイメントのエイリアス管理
• クラスタ名をコードとして管理することで管理のオーバーヘッドを削減し Beat クライアントの構成管理が可能
• デプロイメントエイリアスとオートスケーリングはデプロイメントの Terraform リソース
で設定可能
デプロイメントエイリアス
resource "ec_deployment" "example_minimal" {
region = "us-east-1"
name = "my-example-deployment"
// The deployment can be reached on:// my-
alias.es.us-east-1.aws.cloud.es.io:9423
alias = "my-alias"
version = "7.14"
deployment_template_id = "aws-io-optimized-v2"
elasticsearch {
autoscale = "true"
topology {
id = "cold"
size = "8g"
}
topology {
id = "hot_content"
size = "8g"
autoscaling {
// Optionally change the policy max size.
max_size = "59g"
}
---
---
}
topology {
id = "warm"
size = "8g"
}
}
kibana {}
apm {}
enterprise_search {}
}
デプロイメントエクステンションと ARM 64 デバイスサポート
• デプロイメントエクステンション deployment extensions
• Elastic プラグインやスクリプトバンドルを管理・アップロード
• 新しいリソースタイプ ec_deployment_extension を使⽤
• Elastic Cloud 上でデプロイメントエクステンションやプラグインをアップロード/管理できる
• Elastic Cloud Terraform プロバイダは ARM 64 デバイスにネイティブ対応
• M1 チップ 搭載 Apple MacBook 等最新デバイスからコードとしてインフラを実⾏可能
プロバイダーを使い始める
• Terraform Registry にアクセス
• プロバイダーのドキュメントや機能が調べられる
• Terraform を使って Elastic Cloud のデプロイメントを管理できる
• HashiCorp 社は Terraform Cloud のリモートステートストレージを無料
で提供
Terraform による
Azure Kubernetes Service クラスター作成
Terraform を使⽤して Azure Kubernetes Service で
Kubernetes クラスターを作成
• Azure Kubernetes Service (AKS)
• コンテナオーケストレーションの専⾨知識があまり必要ない
• コンテナー化されたアプリケーションをデプロイして管理可能
• アプリをオフラインにせず、多くの⼀般的なメンテナンス操作
を実⾏可能
• 必要なリソースのプロビジョニング、アップグレード、スケーリングなど
• 次のタスクが必要︓
• HCL (HashiCorp ⾔語) を使⽤した Kubernetes
クラスターの定義
• AKS と Terraform を使⽤した Kubernetes
クラスターの作成
• kubectl ツールを使⽤した Kubernetes クラスターの
可⽤性のテスト
https://docs.microsoft.com/ja-jp/azure/developer/terraform/create-k8s-cluster-with-tf-and-aks
前提条件
Terraform および Azure へのアクセスの構成
Azure CLI で Azure サービス プリンシパルを作成する
Terraform 構成ファイルを保持するディレクトリの作成
//ディレクトリを clouddrive ディレクトリに変更
cd clouddrive
//terraform-aks-k8s という名前のディレクトリを作成
mkdir terraform-aks-k8s
//新しいディレクトリに移動
cd terraform-aks-k8s
Azure プロバイダーを宣⾔する Terraform 構成ファイルの作成
• Bash
• HashiCorp Configuration Language
//HashiCorp Configuration Language
provider "azurerm" {
# The "feature" block is required for AzureRM provider 2.x.
# If you are using version 1.x, the "features" block is not allowed.
version = "~>2.0"
features {}
}
terraform {
backend "azurerm" {}
}
//Cloud Shell で main.tf という名前のファイルを作成
code main.tf
Kubernetes クラスターのリソースを宣⾔する
Terraform 構成ファイルを作成 – 概要
• クラスター名前、場所、およびリソースグループ名を設定
• 完全修飾ドメイン名 (FQDN) のプレフィックスも設定
• FQDN は、クラスターへのアクセスに使⽤される
• linux_profile レコードを使⽤すると、SSH を使⽤してワーカーノードにサインインできる設
定を構成できる
• AKS ではワーカーノードのみについて課⾦される
• default_node_pool レコードでは、これらのワーカーノードの詳細を構成する
• default_node_pool レコードには、作成するワーカーノードの数とワーカーノードの種類が含まれる
• 将来クラスターをスケールアップまたはスケールダウンする必要ある場合は、このレコードの count 値を変更
Kubernetes クラスターのリソースを宣⾔する
Terraform 構成ファイルを作成 - 1
• Bash
//Cloud Shell で k8s.tf という名前のファイルを作成
code k8s.tf
Kubernetes クラスターのリソースを宣⾔する
Terraform 構成ファイルを作成 - 2
• HashiCorp Configuration Language
resource "azurerm_resource_group" "k8s" {
name = var.resource_group_name
location = var.location
}
resource "random_id" "log_analytics_workspace_name_suffix" {
byte_length = 8
}
resource "azurerm_log_analytics_workspace" "test" {
# The WorkSpace name has to be unique across the whole of azure, not just the current
subscription/tenant.
name = "${var.log_analytics_workspace_name}-
${random_id.log_analytics_workspace_name_suffix.dec}"
location = var.log_analytics_workspace_location
resource_group_name = azurerm_resource_group.k8s.name
sku = var.log_analytics_workspace_sku
}
---
Kubernetes クラスターのリソースを宣⾔する
Terraform 構成ファイルを作成 - 3
• HashiCorp Configuration Language
resource "azurerm_log_analytics_solution" "test" {
solution_name = "ContainerInsights"
location = azurerm_log_analytics_workspace.test.location
resource_group_name = azurerm_resource_group.k8s.name
workspace_resource_id = azurerm_log_analytics_workspace.test.id
workspace_name = azurerm_log_analytics_workspace.test.name
plan {
publisher = "Microsoft"
product = "OMSGallery/ContainerInsights"
}
}
---
Kubernetes クラスターのリソースを宣⾔する
Terraform 構成ファイルを作成 - 4
• HashiCorp Configuration Language
resource "azurerm_kubernetes_cluster" "k8s" {
name = var.cluster_name
location = azurerm_resource_group.k8s.location
resource_group_name = azurerm_resource_group.k8s.name
dns_prefix = var.dns_prefix
linux_profile {
admin_username = "ubuntu"
ssh_key {
key_data = file(var.ssh_public_key)
}
}
default_node_pool {
name = "agentpool"
node_count = var.agent_count
vm_size = "Standard_D2_v2"
}
---
Kubernetes クラスターのリソースを宣⾔する
Terraform 構成ファイルを作成 - 5
• HashiCorp Configuration Language
service_principal {
client_id = var.client_id
client_secret = var.client_secret
}
addon_profile {
oms_agent {
enabled = true
log_analytics_workspace_id = azurerm_log_analytics_workspace.test.id
}
}
network_profile {
load_balancer_sku = "Standard"
network_plugin = "kubenet"
}
tags = {
Environment = "Development"
}
}
Cloud Shell で variables.tf という名前のファイルを作成
• HashiCorp Configuration Language
variable "client_id" {}
variable "client_secret" {}
variable "agent_count" {
default = 3
}
variable "ssh_public_key" {
default = "~/.ssh/id_rsa.pub"
}
variable "dns_prefix" {
default = "k8stest"
}
variable cluster_name {
default = "k8stest"
}
---
variable resource_group_name {
default = "azure-k8stest"
}
variable location {
default = "Central US"
}
variable log_analytics_workspace_name {
default = "testLogAnalyticsWorkspaceName"
}
# refer https://azure.microsoft.com/global-
infrastructure/services/?products=monitor for log
analytics available regions
variable log_analytics_workspace_location {
default = "eastus"
}
# refer
https://azure.microsoft.com/pricing/details/monitor/ for
log analytics pricing
variable log_analytics_workspace_sku {
default = "PerGB2018"
}
Terraform 出⼒ファイルを作成 – 概要
Terraform 出⼒
• terraform output コマンドを使⽤してクエリできる
kubectl
Terraform 出⼒ファイルを作成 – 1
• Bash
//Cloud Shell で output.tf という名前のファイルを作成
code output.tf
Terraform 出⼒ファイルを作成 – 2
• HashiCorp Configuration Language
output "client_key" {
value = azurerm_kubernetes_cluster.k8s.kube_config.0.client_key
}
output "client_certificate" {
value = azurerm_kubernetes_cluster.k8s.kube_config.0.client_certificate
}
output "cluster_ca_certificate" {
value = azurerm_kubernetes_cluster.k8s.kube_config.0.cluster_ca_certificate
}
output "cluster_username" {
value = azurerm_kubernetes_cluster.k8s.kube_config.0.username
}
output "cluster_password" {
value = azurerm_kubernetes_cluster.k8s.kube_config.0.password
}
output "kube_config" {
value = azurerm_kubernetes_cluster.k8s.kube_config_raw
}
output "host" {
value = azurerm_kubernetes_cluster.k8s.kube_config.0.host
}
Terraform 状態を保存する Azure Storage セットアップ -1
• このパターンは 1 名の環境に適する
• マルチユーザー環境では、状態の追跡に Azure ストレージが使⽤される
• ストレージアカウント情報 (アカウント名とアカウント キー) を取得
• Terraform 状態の情報を格納するストレージコンテナーを作成
Terraform 状態を保存する Azure Storage セットアップ -2
• たとえば、最初に Cloud Shell を開いたときに作成したストレージ アカウントを使⽤できる
• 通常、Cloud Shell によって作成されたストレージアカウント名は cs の後に数字と⽂字のランダムな⽂字列
Terraform 状態を保存する Azure Storage セットアップ -3
az storage container create -n tfstate --account-name <YourAzureStorageAccountName>
--account-key <YourAzureStorageAccountKey>
Kubernetes クラスターの作成 - 1
• Bash
• terraform init コマンドでバックエンド
およびプロバイダープラグインの初期化
の成功を確認
terraform init
-backend-
config="storage_account_name=<YourAzureStorageAccountName>"
-backend-config="container_name=tfstate"
-backend-config="access_key=<YourStorageAccountAccessKey>”
-backend-config="key=codelab.microsoft.tfstate"
Kubernetes クラスターの作成 - 2
• Bash
• terraform plan コマンドを実⾏
したときに作成されるリソースが表⽰
される
//サービスプリンシパルの資格情報をエクスポート
//プレースホルダーを⾃分のサービスプリンシパルの適切な値に置き換え
export TF_VAR_client_id=<service-principal-appid>
export TF_VAR_client_secret=<service-principal-password>
//terraform plan コマンドを実⾏して、インフラストラクチャ要素を定義する Terraform プランを作成
terraform plan -out out.plan
Kubernetes クラスターの作成 - 3
• Bash
• terraform apply コマンドにより構成ファイル
に定義されたリソースの作成結果が表⽰
• Azure portal 左側のメニューの [すべての
リソース] を選択すると新しい Kubernetes
クラスターに対して作成されたリソースが表⽰
//terraform apply コマンドを実⾏して、プランを適⽤し、Kubernetes クラスターを作成
terraform apply out.plan
Kubernetes クラスターのテスト
• Bash
• ワーカー ノードの詳細を確認してください。次の図のように、すべてのステータスが Ready に
なっている必要があります。
• ワーカーノードの詳細を確認 (すべてのステータスが Ready になっている)
//Terraform 状態から Kubernetes 構成を取得し、kubectl が読み取れるファイルに格納
echo "$(terraform output kube_config)" > ./azurek8s
//kubectl が正しい構成を選択できるように環境変数を設定
export KUBECONFIG=./azurek8s
//クラスターの正常性を確認
kubectl get nodes
Elastic Cloud on Azure の
サンプルアプリのデプロイ
Kubernetes クラスターへのデモアプリのデプロイ
https://www.elastic.co/blog/kubernetes-observability-tutorial-k8s-cluster-setup-demo-app-deployment
GitHubのレポジトリ:
https://github.com/michaelhyatt/k8s-o11y-workshop
本来のサンプルアプリのデプロイの⼿順
//Debian 9, 2-4 CPUs, 8-16GB RAM,
80GB disk を準備(オリジナル)
//Elastic Cloud cluster with APM server
and Kibana をセットアップ
# - cloud.auth, cloud.id, apm.token,
apm.url
//依存関係のインストール
sudo apt install git tmux -y
//コードをチェックアウト
git clone
https://github.com/michaelhyatt/k8s-
o11y-workshop.git
…
//minikube と依存関係をインストールする
$HOME/k8s-o11y-workshop/install/install-
debian9.sh
//Petclinic アプリの Docker イメージをビルドする
cd ~/k8s-o11y-workshop
docker build -t petclinic docker/petclinic
//minikube をローカルで起動する
$HOME/k8s-o11y-
workshop/install/start_k8s.sh
Elastic Cloud on Azure デプロイ https://www.elastic.co/jp/
Elastic Cloud デプロイ (Elastic & 各 Marketplace)
https://www.elastic.co/jp/
https://portal.azure.com/#create/hub
https://aws.amazon.com/marketplace/
https://console.cloud.google.com/marketplace
Elastic
Azure
AWS
GCP
Kibana 起動時の認証情報をダウンロード (.csv)
Elasticsearch エンドポイントデータをコピー
ID : (固定)
elastic
Password : (デプロイ時に取得 → DL)
(例) RHGj80iJUO6CF7WBUMiwyu1x
Endpoint : (デプロイ後に取得)
(例)
8009bf958b6w5923b3c56983d4048df8
24.japaneast.azure.elastic-
cloud.com:9243
Elastic Cloud on Azure デプロイ https://www.elastic.co/jp/
# Get credentials for
create_secrets.sh
# - cloud_id,
cloud_auth,
apm_url,
apm_token
https://github.com/michaelhyatt/k8s-o11y-
workshop/tree/cc6095210180f8526a9fdc518cf9
e3894b9ea9d0#elastic-cloud
Secrets の設定、Beats のセットアップ
• Bash
//create_secrets.sh を更新する(例)
cloud_id=bmGsZY76lXN0LmF6dXJlLmVsYXN0aWMtY2xvdWQuY31u9jkyN
DMkNzAwN2JmJi53jllMHGxEYI0ZDM1NDczOTM0XY75MDMkZjMyNTNhMmNm
M2U3NDYyYThkZTcwOWNmYXYlOTBjNjc=
cloud_auth=elastic:oGKMG79iFXGNhg68VdBFiwm2x
apm_url=https://887a6b5ab5ab316ub38f02482f792527.apm.japan
east.azure.elastic-cloud.com
apm_token=ef36MGhyODxuMZuNkBF6
Secrets の設定、Beats のセットアップ
//create_secrets.sh を更新して実⾏する
$HOME/k8s-o11y-workshop/install/create_secrets.sh
./create_secrets.sh
//metricbeat と filebeat を動かしてセットアップする
kubectl create -n kube-system -f metricbeat/metricbeat-setup.yml
kubectl create -n kube-system -f filebeat/filebeat-setup.yml
//完了状況をウォッチする (completed になれば OK)
kubectl get pods --namespace=kube-system
• Bash
デプロイメントエイリアス
resource "ec_deployment" "example_minimal" {
region = "us-east-1"
name = "my-example-deployment"
// The deployment can be reached on:// my-
alias.es.us-east-1.aws.cloud.es.io:9423
alias = "my-alias"
version = "7.14"
deployment_template_id = "aws-io-optimized-v2"
elasticsearch {
autoscale = "true"
topology {
id = "cold"
size = "8g"
}
topology {
id = "hot_content"
size = "8g"
autoscaling {
// Optionally change the policy max size.
max_size = "59g"
}
---
---
}
topology {
id = "warm"
size = "8g"
}
}
kibana {}
apm {}
enterprise_search {}
}
Elastic Cloud
Elastic Observability サンプルアプリ on AKS
filebeat
metricbeat
packetbeat
APM
MySQL
Azure Kubernetes
Service (AKS)
https://github.com/michaelhyatt/k8s-o11y-workshop
東⽇本リージョン
マスターノード x 1
データノード x 2
ML ノード x 1
https://f79...c67.japaneast.azure.elastic-cloud.com:9243/
Elastic x Azure 統合による
Observability と APM の進化
Azure x Elastic Deep Integration
Extend
Customer
Engagement
Grow Support
Build
Together
Evaluate
Requirements
Building towards a delightful and powerful
Elastic on Azure user experience:
Goals:
• 完全にサポートされ、統合された製品のポート
フォリオをお客様に提供
• Azure での Elasticsearch Services の
検出とデプロイに関する統合エクスペリエンス
• SSO を介した Azure と Elastic Cloud の
シームレスなポータル エクスペリエンス
• Azure でのファーストクラスのサービスと機能の
提供について柔軟に対応を促進する
– プライベート リンク、ログ転送、Kibana ビジュアライゼーション
Elastic
ネイティブ統合の Next Step
● より多くの Region のサポート
● 多くの Azure サービスとのより
深い統合
● Azure Active Directory との
統合
● その他
フィードバックはこちらまで :
ela.st/azure
Microsoft Japan Digital Days (10/12-14)
https://www.microsoft.com/ja-jp/events/top/digital-days.aspx
まとめ
まとめ
l Elastic 概要
l Elastic Observability
l Elastic and HashiCorp
l Terraform による Azure Kubernetes Service クラスター
作成
l Elastic Cloud on Azure へのサンプルアプリのデプロイ
l Elastic x Azure 統合による Observability と APM の進化
リソース
• 公式ドキュメント
https://www.elastic.co/guide/index.html
• クラウドネイティブ アプリでの Elasticsearch
https://docs.microsoft.com/ja-jp/dotnet/architecture/cloud-
native/elastic-search-in-azure
• Azure での検索データ ストアの選択
https://docs.microsoft.com/ja-jp/azure/architecture/data-
guide/technology-choices/search-options
• Elastic APM Agent
https://www.elastic.co/guide/en/apm/agent/index.html
• Reactivesearch
https://opensource.appbase.io/reactivesearch/
• 優れた React 検索エクスペリエンスを迅速に構築する
⽅法
https://www.elastic.co/jp/blog/how-to-build-great-react-
search-experiences-quickly
• Search UI Elastic GitHub レポジトリ
https://github.com/elastic/search-ui
• APM
https://www.elastic.co/jp/apm/
• Configuration on .NET Core
https://www.elastic.co/guide/en/apm/agent/dotnet/current/co
nfiguration-on-asp-net-core.html
• ASP.NET Core Quick Start
https://www.elastic.co/guide/en/apm/agent/dotnet/current/set
up-asp-net-core.html
• K8s Observability サンプルソリューション GitHub
レポジトリ
https://github.com/michaelhyatt/k8s-o11y-workshop
• 関連ブログ
https://www.elastic.co/jp/blog/kubernetes-observability-
tutorial-k8s-cluster-setup-demo-app-deployment
https://www.elastic.co/blog/kubernetes-observability-tutorial-
k8s-log-monitoring-and-analysis-elastic-stack
https://www.elastic.co/blog/kubernetes-observability-tutorial-
k8s-metrics-collection-and-analysis
https://www.elastic.co/blog/kubernetes-observability-tutorial-
k8s-monitoring-application-performance-with-elastic-apm
Thank you for your attention!

More Related Content

PDF
7.9 elasticstackandcloudtechnicalenablement excitingnewfeatures-jpn0827
PDF
whats-new-in-elastic-7-14
PDF
Apm enables python app observability
PDF
Azure kobebase lt-20201120
PDF
Elastic 7.13-new-features-20210624
PDF
Elastic circle ci-co-webinar-20210127
PDF
Elastic stack_&_cloud_7.11_updates-summary
PDF
Utilizing elasticcloudforallusecases
7.9 elasticstackandcloudtechnicalenablement excitingnewfeatures-jpn0827
whats-new-in-elastic-7-14
Apm enables python app observability
Azure kobebase lt-20201120
Elastic 7.13-new-features-20210624
Elastic circle ci-co-webinar-20210127
Elastic stack_&_cloud_7.11_updates-summary
Utilizing elasticcloudforallusecases

What's hot (20)

PDF
Moving from on prem to managed services with elastic on azure-final
PDF
Gpu accelerates aimodeldevelopmentandanalyticsutilizingelasticsearchandazure ai
PDF
Elastic7.12 release-new-features-on-0428
PDF
Elastichelps fintechenablesdx usingaibasedautomationand anomalydetection
PDF
Elastic7.10 newfeaturesintroduce 1216
PDF
Tech summit 2018_ad15_ver_1106
PDF
Monitoring the health and performance of your aws environment using the Elast...
PDF
Big query and elasticsearch insight at scale
PDF
Elastic observabilitycansmartlymanagetheappsonkubernetes
PDF
Building modernapplicationwithelasiccloud
PPTX
Evolution of Observability and APM with using Elastic and Microsoft Azure
PDF
Renewed using elasticsearchonaspnet-core5
PDF
Migrating tocloudnativeapplicationwithusingelasticapm
PDF
Elastic on-microsoft-azure-0630-webinar-no-video
PDF
Enterprise agile dev ops-and-xr-techonology-adoption-for-fintech-20180324
PDF
Learn, build, and scale with elastic - realizing great programming experience...
PDF
Dist 29 gcp_serverless_web_app_development
PDF
MAF2013 Enterprise Windows 8 – Architecture for rapid development of WinRT apps
PDF
Realizling Dapr Observability Using Elastic Stack
PDF
[CTC Forum 2019/10/25] 事例から学ぶ!AWS 移行でデータベースの管理・コストを削減する方法
Moving from on prem to managed services with elastic on azure-final
Gpu accelerates aimodeldevelopmentandanalyticsutilizingelasticsearchandazure ai
Elastic7.12 release-new-features-on-0428
Elastichelps fintechenablesdx usingaibasedautomationand anomalydetection
Elastic7.10 newfeaturesintroduce 1216
Tech summit 2018_ad15_ver_1106
Monitoring the health and performance of your aws environment using the Elast...
Big query and elasticsearch insight at scale
Elastic observabilitycansmartlymanagetheappsonkubernetes
Building modernapplicationwithelasiccloud
Evolution of Observability and APM with using Elastic and Microsoft Azure
Renewed using elasticsearchonaspnet-core5
Migrating tocloudnativeapplicationwithusingelasticapm
Elastic on-microsoft-azure-0630-webinar-no-video
Enterprise agile dev ops-and-xr-techonology-adoption-for-fintech-20180324
Learn, build, and scale with elastic - realizing great programming experience...
Dist 29 gcp_serverless_web_app_development
MAF2013 Enterprise Windows 8 – Architecture for rapid development of WinRT apps
Realizling Dapr Observability Using Elastic Stack
[CTC Forum 2019/10/25] 事例から学ぶ!AWS 移行でデータベースの管理・コストを削減する方法
Ad

Similar to Building andobservingcloudnativeappliactionusingazure elastic-terraform (20)

PDF
Terraform Bootcamp - Azure Infrastructure as Code隊
PPTX
15分でお届けする Elastic Stack on Azure 設計・構築ノウハウ
PDF
俺の Kubernetes Workflow with HashiStack
PPTX
Container x azure x kubernetes
PDF
20191209 hccjp azure-stackhub_overview
PDF
Introduction to extensions and other useful features for developing apps usin...
PDF
2021/03/19 パブリッククラウドを活かす運用プロセス自動化
PDF
AKSとTerraformでKubernetesクラスター作成
PDF
Architecting on Alibaba Cloud - Fundamentals - 2018
PDF
Azure Infrastructure as Code 体験入隊
PDF
Terraform始めました
PDF
Azure Kubernetes Service Overview
PDF
俺とHashiCorp
PDF
PDF
Terraformを使ったCloudStack環境構築
PPTX
Azure Pipline × Terraform
PPTX
これから始める Azure の基礎サービス: IaaS/PaaS
PDF
Elastic on Azure Integration & Building React UI Based Search App Using Azure...
PDF
Gmo media terraform slide
PDF
20190201 Cloud Native Kansai AKS Azure
Terraform Bootcamp - Azure Infrastructure as Code隊
15分でお届けする Elastic Stack on Azure 設計・構築ノウハウ
俺の Kubernetes Workflow with HashiStack
Container x azure x kubernetes
20191209 hccjp azure-stackhub_overview
Introduction to extensions and other useful features for developing apps usin...
2021/03/19 パブリッククラウドを活かす運用プロセス自動化
AKSとTerraformでKubernetesクラスター作成
Architecting on Alibaba Cloud - Fundamentals - 2018
Azure Infrastructure as Code 体験入隊
Terraform始めました
Azure Kubernetes Service Overview
俺とHashiCorp
Terraformを使ったCloudStack環境構築
Azure Pipline × Terraform
これから始める Azure の基礎サービス: IaaS/PaaS
Elastic on Azure Integration & Building React UI Based Search App Using Azure...
Gmo media terraform slide
20190201 Cloud Native Kansai AKS Azure
Ad

More from Shotaro Suzuki (20)

PDF
This is how our first offline technical event in three years was able to succ...
PDF
Introducing the new features of the Elastic 8.6 release.pdf
PDF
NET MAUI for .NET 7 for iOS, Android app development
PDF
What's New in the Elastic 8.5 Release
PDF
Centralized Observability for the Azure Ecosystem
PDF
What's New in the Elastic 8.4 Release
PDF
Power Apps x .NET ~ Transforming Business Applications with Fusion Development
PDF
devreljapan2022evaadvoc-final.pdf
PDF
elastic-mabl-co-webinar-20220729
PDF
Application development with c#, .net 6, blazor web assembly, asp.net web api...
PDF
Discover what's new in the Elastic 8.3 release - Find, monitor, and protect e...
PDF
Building a search experience with Elastic – Introducing Elastic's latest samp...
PDF
Developing .NET 6 Blazor WebAssemby apps with Radzen Blazor component library...
PDF
Elastic x Microsoft Azure Integration Evolution - Integrated Monitoring for S...
PDF
Building 3D mobile apps using Power Apps Mixed Reality controls, Azure SQL Da...
PDF
What's New in the Elastic 8.2 Release - Seamless User Experience with Search -
PDF
Application development with c#, .net 6, blazor web assembly, asp.net web api...
PDF
Building Software Reliability through Distributed Tracing.pdf
PDF
Building a Flutter Development Environment with VSCode and Useful Extensions
PDF
Application development with c#, .net 6, blazor web assembly, asp.net web api...
This is how our first offline technical event in three years was able to succ...
Introducing the new features of the Elastic 8.6 release.pdf
NET MAUI for .NET 7 for iOS, Android app development
What's New in the Elastic 8.5 Release
Centralized Observability for the Azure Ecosystem
What's New in the Elastic 8.4 Release
Power Apps x .NET ~ Transforming Business Applications with Fusion Development
devreljapan2022evaadvoc-final.pdf
elastic-mabl-co-webinar-20220729
Application development with c#, .net 6, blazor web assembly, asp.net web api...
Discover what's new in the Elastic 8.3 release - Find, monitor, and protect e...
Building a search experience with Elastic – Introducing Elastic's latest samp...
Developing .NET 6 Blazor WebAssemby apps with Radzen Blazor component library...
Elastic x Microsoft Azure Integration Evolution - Integrated Monitoring for S...
Building 3D mobile apps using Power Apps Mixed Reality controls, Azure SQL Da...
What's New in the Elastic 8.2 Release - Seamless User Experience with Search -
Application development with c#, .net 6, blazor web assembly, asp.net web api...
Building Software Reliability through Distributed Tracing.pdf
Building a Flutter Development Environment with VSCode and Useful Extensions
Application development with c#, .net 6, blazor web assembly, asp.net web api...

Building andobservingcloudnativeappliactionusingazure elastic-terraform

  • 1. Azure x Elastic x Terraform で クラウドネイティブアプリケーションを 構築して監視する 鈴⽊ 章太郎 Elastic テクニカルプロダクトマーケティングマネージャー/エバンジェリスト デジタル庁 プロジェクトマネージャー
  • 3. l Elastic 概要 l Elastic Observability l Elastic and HashiCorp l Terraform による Azure Kubernetes Service クラスター 作成 l Elastic Cloud on Azure へのサンプルアプリのデプロイ l Elastic x Azure 統合による Observability と APM の進化 l まとめ アジェンダ
  • 5. 3 億 5,000 万以上のダウンロード、 12,000 以上の企業での採⽤ 40 カ国以上で 2,000 ⼈の従業員 IPO 2018, NYSE: “ESTC” 2012 年設⽴ Elastic 会社概要 Distributed by design About Elastic 世界の #1 データベース検索エンジン (DB-Engines)
  • 6. 3 Solutions, 1 Stack, Deploy Anywhere Elastic Stack Kibana Elasticsearch Beats Logstash Elastic エンタープライズサーチ Elastic セキュリティ Elastic オブザーバビリティ 3 つのソリューション SaaS (AWS/Azure/GCP) IaaS (クラウド & オンプレ) Elastic Cloud on Kubernetes Elastic Cloud Elastic Cloud Enterprise 豊富なデプロイ選択肢 Kubernetes (クラウド & オンプレ) 蓄積、検索、分析 可視化 & 管理 収集
  • 8. マイクロ サービス コンテナ CI / CD オーケストレーション サーバレス クラウド ソフトウェアの開発⽅法とデリバリーは常に進化
  • 12. Application Performance Monitoring (APM) • ログ、APM、インフラメトリックは監視の3⼤要素 • 3つの領域には重なり合う部分もあり相互に関連付ける際に 役⽴つ • ログはエラーが⽣じた痕跡のみでエラーの理由までは⽰さない • メトリックはサーバー上で CPU 使⽤量にスパイクがあったこと を⽰すかもしれないが、何が原因だったかは⽰さない • ログやメトリックは、インフラや複数のコンポーネントを扱う横断 的なデータ • うまく組み合わせて活⽤すれば、はるかに広い範囲の問題を 解決できる可能性がある • APM はメトリックとログのギャップに橋を架ける存在
  • 13. Elastic Application Performance Monitoring • マルチページ、シングルページ、双⽅のアプリで有効 • Node.js、Python、Ruby、.NET、 Java、Go、 PHP、Real User Monitoring(JS SPA) • 対応⾔語のさらなる追加も予定 • Elastic がサポートする⾔語はこちら • Jaeger や OpenTelemetry 等各種のオープン スタンダードもサポート • インストルメンテーション済みのアプリから Elastic APM へ驚くほど簡単にデータを送れる • 必要なモジュールが⾒つからなくても独⾃に開発も、 オープンソースコミュニティの成果物の活⽤も可能 • APM から応答時間ベース Machine Learning ジョブを作成する機能もあり
  • 15. Elastic and HashiCorp partner to bring infrastructure-as-code to Elastic Cloud https://www.elastic.co/jp/blog/elastic-hashicorp-partner-to-bring-infrastructure-as-code-to-elastic-cloud
  • 16. Elastic社とHashiCorp 社が提携し Elastic Cloud でInfrastructure-as-code を可能に • Elastic Cloud ⽤ Terraform 検証済みプロバイダー • Elastic Cloud • Elastic Cloud Enterprise • Elastic Cloud on Kubernetes • Elastic Cloud Terraform プロバイダの使⽤ • 同じ⾃動化コードを使⽤してデプロイメントを実施可能 • オンプレミス or 全パブリッククラウド(AWS/Azure/GCP)で実⾏できる • このプロバイダはベータ版 beta version がベース • オートスケーリング autoscaling やデプロイメントエイリアスなどの Elastic Cloud の機能を活⽤できる • 新しいデプロイメント拡張機能を利⽤して ARM64 デバイス上でプロバイダを実⾏できる
  • 17. デプロイメントのオートスケーリング • Terraform プロバイダを使⽤することにより、デプロイメントのトポロジーやデータ層の構成に かかわらず、デプロイメントの⾃動スケーリングポリシーを制御および変更できる • サイズを動的に拡張するデプロイメントを作成することで、デプロイメントのパフォーマンスと 信頼性を維持することができる • リソースの使⽤量が増えると、リソースの容量も増える
  • 18. デプロイメントエイリアス • デプロイメントエンドポイントのエイリアス deployment endpoint alias を 作成 • インターネット経由で利⽤可能なユーザー指定の名前でデプロイメントにアクセスできる • 変数と tfvars ファイルを使⽤したデプロイメントのエイリアス管理 • クラスタ名をコードとして管理することで管理のオーバーヘッドを削減し Beat クライアントの構成管理が可能 • デプロイメントエイリアスとオートスケーリングはデプロイメントの Terraform リソース で設定可能
  • 19. デプロイメントエイリアス resource "ec_deployment" "example_minimal" { region = "us-east-1" name = "my-example-deployment" // The deployment can be reached on:// my- alias.es.us-east-1.aws.cloud.es.io:9423 alias = "my-alias" version = "7.14" deployment_template_id = "aws-io-optimized-v2" elasticsearch { autoscale = "true" topology { id = "cold" size = "8g" } topology { id = "hot_content" size = "8g" autoscaling { // Optionally change the policy max size. max_size = "59g" } --- --- } topology { id = "warm" size = "8g" } } kibana {} apm {} enterprise_search {} }
  • 20. デプロイメントエクステンションと ARM 64 デバイスサポート • デプロイメントエクステンション deployment extensions • Elastic プラグインやスクリプトバンドルを管理・アップロード • 新しいリソースタイプ ec_deployment_extension を使⽤ • Elastic Cloud 上でデプロイメントエクステンションやプラグインをアップロード/管理できる • Elastic Cloud Terraform プロバイダは ARM 64 デバイスにネイティブ対応 • M1 チップ 搭載 Apple MacBook 等最新デバイスからコードとしてインフラを実⾏可能
  • 21. プロバイダーを使い始める • Terraform Registry にアクセス • プロバイダーのドキュメントや機能が調べられる • Terraform を使って Elastic Cloud のデプロイメントを管理できる • HashiCorp 社は Terraform Cloud のリモートステートストレージを無料 で提供
  • 22. Terraform による Azure Kubernetes Service クラスター作成
  • 23. Terraform を使⽤して Azure Kubernetes Service で Kubernetes クラスターを作成 • Azure Kubernetes Service (AKS) • コンテナオーケストレーションの専⾨知識があまり必要ない • コンテナー化されたアプリケーションをデプロイして管理可能 • アプリをオフラインにせず、多くの⼀般的なメンテナンス操作 を実⾏可能 • 必要なリソースのプロビジョニング、アップグレード、スケーリングなど • 次のタスクが必要︓ • HCL (HashiCorp ⾔語) を使⽤した Kubernetes クラスターの定義 • AKS と Terraform を使⽤した Kubernetes クラスターの作成 • kubectl ツールを使⽤した Kubernetes クラスターの 可⽤性のテスト https://docs.microsoft.com/ja-jp/azure/developer/terraform/create-k8s-cluster-with-tf-and-aks
  • 24. 前提条件 Terraform および Azure へのアクセスの構成 Azure CLI で Azure サービス プリンシパルを作成する
  • 25. Terraform 構成ファイルを保持するディレクトリの作成 //ディレクトリを clouddrive ディレクトリに変更 cd clouddrive //terraform-aks-k8s という名前のディレクトリを作成 mkdir terraform-aks-k8s //新しいディレクトリに移動 cd terraform-aks-k8s
  • 26. Azure プロバイダーを宣⾔する Terraform 構成ファイルの作成 • Bash • HashiCorp Configuration Language //HashiCorp Configuration Language provider "azurerm" { # The "feature" block is required for AzureRM provider 2.x. # If you are using version 1.x, the "features" block is not allowed. version = "~>2.0" features {} } terraform { backend "azurerm" {} } //Cloud Shell で main.tf という名前のファイルを作成 code main.tf
  • 27. Kubernetes クラスターのリソースを宣⾔する Terraform 構成ファイルを作成 – 概要 • クラスター名前、場所、およびリソースグループ名を設定 • 完全修飾ドメイン名 (FQDN) のプレフィックスも設定 • FQDN は、クラスターへのアクセスに使⽤される • linux_profile レコードを使⽤すると、SSH を使⽤してワーカーノードにサインインできる設 定を構成できる • AKS ではワーカーノードのみについて課⾦される • default_node_pool レコードでは、これらのワーカーノードの詳細を構成する • default_node_pool レコードには、作成するワーカーノードの数とワーカーノードの種類が含まれる • 将来クラスターをスケールアップまたはスケールダウンする必要ある場合は、このレコードの count 値を変更
  • 28. Kubernetes クラスターのリソースを宣⾔する Terraform 構成ファイルを作成 - 1 • Bash //Cloud Shell で k8s.tf という名前のファイルを作成 code k8s.tf
  • 29. Kubernetes クラスターのリソースを宣⾔する Terraform 構成ファイルを作成 - 2 • HashiCorp Configuration Language resource "azurerm_resource_group" "k8s" { name = var.resource_group_name location = var.location } resource "random_id" "log_analytics_workspace_name_suffix" { byte_length = 8 } resource "azurerm_log_analytics_workspace" "test" { # The WorkSpace name has to be unique across the whole of azure, not just the current subscription/tenant. name = "${var.log_analytics_workspace_name}- ${random_id.log_analytics_workspace_name_suffix.dec}" location = var.log_analytics_workspace_location resource_group_name = azurerm_resource_group.k8s.name sku = var.log_analytics_workspace_sku } ---
  • 30. Kubernetes クラスターのリソースを宣⾔する Terraform 構成ファイルを作成 - 3 • HashiCorp Configuration Language resource "azurerm_log_analytics_solution" "test" { solution_name = "ContainerInsights" location = azurerm_log_analytics_workspace.test.location resource_group_name = azurerm_resource_group.k8s.name workspace_resource_id = azurerm_log_analytics_workspace.test.id workspace_name = azurerm_log_analytics_workspace.test.name plan { publisher = "Microsoft" product = "OMSGallery/ContainerInsights" } } ---
  • 31. Kubernetes クラスターのリソースを宣⾔する Terraform 構成ファイルを作成 - 4 • HashiCorp Configuration Language resource "azurerm_kubernetes_cluster" "k8s" { name = var.cluster_name location = azurerm_resource_group.k8s.location resource_group_name = azurerm_resource_group.k8s.name dns_prefix = var.dns_prefix linux_profile { admin_username = "ubuntu" ssh_key { key_data = file(var.ssh_public_key) } } default_node_pool { name = "agentpool" node_count = var.agent_count vm_size = "Standard_D2_v2" } ---
  • 32. Kubernetes クラスターのリソースを宣⾔する Terraform 構成ファイルを作成 - 5 • HashiCorp Configuration Language service_principal { client_id = var.client_id client_secret = var.client_secret } addon_profile { oms_agent { enabled = true log_analytics_workspace_id = azurerm_log_analytics_workspace.test.id } } network_profile { load_balancer_sku = "Standard" network_plugin = "kubenet" } tags = { Environment = "Development" } }
  • 33. Cloud Shell で variables.tf という名前のファイルを作成 • HashiCorp Configuration Language variable "client_id" {} variable "client_secret" {} variable "agent_count" { default = 3 } variable "ssh_public_key" { default = "~/.ssh/id_rsa.pub" } variable "dns_prefix" { default = "k8stest" } variable cluster_name { default = "k8stest" } --- variable resource_group_name { default = "azure-k8stest" } variable location { default = "Central US" } variable log_analytics_workspace_name { default = "testLogAnalyticsWorkspaceName" } # refer https://azure.microsoft.com/global- infrastructure/services/?products=monitor for log analytics available regions variable log_analytics_workspace_location { default = "eastus" } # refer https://azure.microsoft.com/pricing/details/monitor/ for log analytics pricing variable log_analytics_workspace_sku { default = "PerGB2018" }
  • 34. Terraform 出⼒ファイルを作成 – 概要 Terraform 出⼒ • terraform output コマンドを使⽤してクエリできる kubectl
  • 35. Terraform 出⼒ファイルを作成 – 1 • Bash //Cloud Shell で output.tf という名前のファイルを作成 code output.tf
  • 36. Terraform 出⼒ファイルを作成 – 2 • HashiCorp Configuration Language output "client_key" { value = azurerm_kubernetes_cluster.k8s.kube_config.0.client_key } output "client_certificate" { value = azurerm_kubernetes_cluster.k8s.kube_config.0.client_certificate } output "cluster_ca_certificate" { value = azurerm_kubernetes_cluster.k8s.kube_config.0.cluster_ca_certificate } output "cluster_username" { value = azurerm_kubernetes_cluster.k8s.kube_config.0.username } output "cluster_password" { value = azurerm_kubernetes_cluster.k8s.kube_config.0.password } output "kube_config" { value = azurerm_kubernetes_cluster.k8s.kube_config_raw } output "host" { value = azurerm_kubernetes_cluster.k8s.kube_config.0.host }
  • 37. Terraform 状態を保存する Azure Storage セットアップ -1 • このパターンは 1 名の環境に適する • マルチユーザー環境では、状態の追跡に Azure ストレージが使⽤される • ストレージアカウント情報 (アカウント名とアカウント キー) を取得 • Terraform 状態の情報を格納するストレージコンテナーを作成
  • 38. Terraform 状態を保存する Azure Storage セットアップ -2 • たとえば、最初に Cloud Shell を開いたときに作成したストレージ アカウントを使⽤できる • 通常、Cloud Shell によって作成されたストレージアカウント名は cs の後に数字と⽂字のランダムな⽂字列
  • 39. Terraform 状態を保存する Azure Storage セットアップ -3 az storage container create -n tfstate --account-name <YourAzureStorageAccountName> --account-key <YourAzureStorageAccountKey>
  • 40. Kubernetes クラスターの作成 - 1 • Bash • terraform init コマンドでバックエンド およびプロバイダープラグインの初期化 の成功を確認 terraform init -backend- config="storage_account_name=<YourAzureStorageAccountName>" -backend-config="container_name=tfstate" -backend-config="access_key=<YourStorageAccountAccessKey>” -backend-config="key=codelab.microsoft.tfstate"
  • 41. Kubernetes クラスターの作成 - 2 • Bash • terraform plan コマンドを実⾏ したときに作成されるリソースが表⽰ される //サービスプリンシパルの資格情報をエクスポート //プレースホルダーを⾃分のサービスプリンシパルの適切な値に置き換え export TF_VAR_client_id=<service-principal-appid> export TF_VAR_client_secret=<service-principal-password> //terraform plan コマンドを実⾏して、インフラストラクチャ要素を定義する Terraform プランを作成 terraform plan -out out.plan
  • 42. Kubernetes クラスターの作成 - 3 • Bash • terraform apply コマンドにより構成ファイル に定義されたリソースの作成結果が表⽰ • Azure portal 左側のメニューの [すべての リソース] を選択すると新しい Kubernetes クラスターに対して作成されたリソースが表⽰ //terraform apply コマンドを実⾏して、プランを適⽤し、Kubernetes クラスターを作成 terraform apply out.plan
  • 43. Kubernetes クラスターのテスト • Bash • ワーカー ノードの詳細を確認してください。次の図のように、すべてのステータスが Ready に なっている必要があります。 • ワーカーノードの詳細を確認 (すべてのステータスが Ready になっている) //Terraform 状態から Kubernetes 構成を取得し、kubectl が読み取れるファイルに格納 echo "$(terraform output kube_config)" > ./azurek8s //kubectl が正しい構成を選択できるように環境変数を設定 export KUBECONFIG=./azurek8s //クラスターの正常性を確認 kubectl get nodes
  • 44. Elastic Cloud on Azure の サンプルアプリのデプロイ
  • 47. 本来のサンプルアプリのデプロイの⼿順 //Debian 9, 2-4 CPUs, 8-16GB RAM, 80GB disk を準備(オリジナル) //Elastic Cloud cluster with APM server and Kibana をセットアップ # - cloud.auth, cloud.id, apm.token, apm.url //依存関係のインストール sudo apt install git tmux -y //コードをチェックアウト git clone https://github.com/michaelhyatt/k8s- o11y-workshop.git … //minikube と依存関係をインストールする $HOME/k8s-o11y-workshop/install/install- debian9.sh //Petclinic アプリの Docker イメージをビルドする cd ~/k8s-o11y-workshop docker build -t petclinic docker/petclinic //minikube をローカルで起動する $HOME/k8s-o11y- workshop/install/start_k8s.sh
  • 48. Elastic Cloud on Azure デプロイ https://www.elastic.co/jp/
  • 49. Elastic Cloud デプロイ (Elastic & 各 Marketplace) https://www.elastic.co/jp/ https://portal.azure.com/#create/hub https://aws.amazon.com/marketplace/ https://console.cloud.google.com/marketplace Elastic Azure AWS GCP
  • 51. Elasticsearch エンドポイントデータをコピー ID : (固定) elastic Password : (デプロイ時に取得 → DL) (例) RHGj80iJUO6CF7WBUMiwyu1x Endpoint : (デプロイ後に取得) (例) 8009bf958b6w5923b3c56983d4048df8 24.japaneast.azure.elastic- cloud.com:9243
  • 52. Elastic Cloud on Azure デプロイ https://www.elastic.co/jp/ # Get credentials for create_secrets.sh # - cloud_id, cloud_auth, apm_url, apm_token https://github.com/michaelhyatt/k8s-o11y- workshop/tree/cc6095210180f8526a9fdc518cf9 e3894b9ea9d0#elastic-cloud
  • 53. Secrets の設定、Beats のセットアップ • Bash //create_secrets.sh を更新する(例) cloud_id=bmGsZY76lXN0LmF6dXJlLmVsYXN0aWMtY2xvdWQuY31u9jkyN DMkNzAwN2JmJi53jllMHGxEYI0ZDM1NDczOTM0XY75MDMkZjMyNTNhMmNm M2U3NDYyYThkZTcwOWNmYXYlOTBjNjc= cloud_auth=elastic:oGKMG79iFXGNhg68VdBFiwm2x apm_url=https://887a6b5ab5ab316ub38f02482f792527.apm.japan east.azure.elastic-cloud.com apm_token=ef36MGhyODxuMZuNkBF6
  • 54. Secrets の設定、Beats のセットアップ //create_secrets.sh を更新して実⾏する $HOME/k8s-o11y-workshop/install/create_secrets.sh ./create_secrets.sh //metricbeat と filebeat を動かしてセットアップする kubectl create -n kube-system -f metricbeat/metricbeat-setup.yml kubectl create -n kube-system -f filebeat/filebeat-setup.yml //完了状況をウォッチする (completed になれば OK) kubectl get pods --namespace=kube-system • Bash
  • 55. デプロイメントエイリアス resource "ec_deployment" "example_minimal" { region = "us-east-1" name = "my-example-deployment" // The deployment can be reached on:// my- alias.es.us-east-1.aws.cloud.es.io:9423 alias = "my-alias" version = "7.14" deployment_template_id = "aws-io-optimized-v2" elasticsearch { autoscale = "true" topology { id = "cold" size = "8g" } topology { id = "hot_content" size = "8g" autoscaling { // Optionally change the policy max size. max_size = "59g" } --- --- } topology { id = "warm" size = "8g" } } kibana {} apm {} enterprise_search {} }
  • 56. Elastic Cloud Elastic Observability サンプルアプリ on AKS filebeat metricbeat packetbeat APM MySQL Azure Kubernetes Service (AKS) https://github.com/michaelhyatt/k8s-o11y-workshop 東⽇本リージョン マスターノード x 1 データノード x 2 ML ノード x 1 https://f79...c67.japaneast.azure.elastic-cloud.com:9243/
  • 57. Elastic x Azure 統合による Observability と APM の進化
  • 58. Azure x Elastic Deep Integration Extend Customer Engagement Grow Support Build Together Evaluate Requirements Building towards a delightful and powerful Elastic on Azure user experience: Goals: • 完全にサポートされ、統合された製品のポート フォリオをお客様に提供 • Azure での Elasticsearch Services の 検出とデプロイに関する統合エクスペリエンス • SSO を介した Azure と Elastic Cloud の シームレスなポータル エクスペリエンス • Azure でのファーストクラスのサービスと機能の 提供について柔軟に対応を促進する – プライベート リンク、ログ転送、Kibana ビジュアライゼーション Elastic
  • 59. ネイティブ統合の Next Step ● より多くの Region のサポート ● 多くの Azure サービスとのより 深い統合 ● Azure Active Directory との 統合 ● その他 フィードバックはこちらまで : ela.st/azure
  • 60. Microsoft Japan Digital Days (10/12-14) https://www.microsoft.com/ja-jp/events/top/digital-days.aspx
  • 62. まとめ l Elastic 概要 l Elastic Observability l Elastic and HashiCorp l Terraform による Azure Kubernetes Service クラスター 作成 l Elastic Cloud on Azure へのサンプルアプリのデプロイ l Elastic x Azure 統合による Observability と APM の進化
  • 63. リソース • 公式ドキュメント https://www.elastic.co/guide/index.html • クラウドネイティブ アプリでの Elasticsearch https://docs.microsoft.com/ja-jp/dotnet/architecture/cloud- native/elastic-search-in-azure • Azure での検索データ ストアの選択 https://docs.microsoft.com/ja-jp/azure/architecture/data- guide/technology-choices/search-options • Elastic APM Agent https://www.elastic.co/guide/en/apm/agent/index.html • Reactivesearch https://opensource.appbase.io/reactivesearch/ • 優れた React 検索エクスペリエンスを迅速に構築する ⽅法 https://www.elastic.co/jp/blog/how-to-build-great-react- search-experiences-quickly • Search UI Elastic GitHub レポジトリ https://github.com/elastic/search-ui • APM https://www.elastic.co/jp/apm/ • Configuration on .NET Core https://www.elastic.co/guide/en/apm/agent/dotnet/current/co nfiguration-on-asp-net-core.html • ASP.NET Core Quick Start https://www.elastic.co/guide/en/apm/agent/dotnet/current/set up-asp-net-core.html • K8s Observability サンプルソリューション GitHub レポジトリ https://github.com/michaelhyatt/k8s-o11y-workshop • 関連ブログ https://www.elastic.co/jp/blog/kubernetes-observability- tutorial-k8s-cluster-setup-demo-app-deployment https://www.elastic.co/blog/kubernetes-observability-tutorial- k8s-log-monitoring-and-analysis-elastic-stack https://www.elastic.co/blog/kubernetes-observability-tutorial- k8s-metrics-collection-and-analysis https://www.elastic.co/blog/kubernetes-observability-tutorial- k8s-monitoring-application-performance-with-elastic-apm
  • 64. Thank you for your attention!