2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Amazon Linux 2023 に Instana Self-hosted Synthetic PoP を構築する(popctl v0.2.3)

2
Posted at

はじめに

IBM Instana の Synthetic Monitoring では、Self-hosted の Synthetic PoP(Point of Presence)を任意のサーバーに構築できます。
popctl というCLIツールを使えば、K3s クラスターの作成から Synthetic PoP のデプロイまでワンストップで行えます。

本記事では、Amazon Linux 2023(EC2)上に popctl v0.2.3 を使って Synthetic PoP を構築し、
Browser Script テストで外形監視を行うまでの手順を記載します。

前提条件

  • Amazon Linux 2023(EC2)
  • ディスク容量: 最低 20 GB(本番環境は 50 GB 以上推奨)
  • Instana の Download Key / Agent Key を取得済み
  • Instana バックエンドへの接続(mizu.instana.io 等)が可能

参考: ディスク使用量(実測値)

項目 容量
Synthetic PoP コンテナイメージ合計 約 2.6 GB
K3s システムイメージ 約 53 MB
OS + K3s + Synthetic PoP 全体 約 10 GB

手順

Step 1 – popctl のインストール

export DOWNLOAD_KEY=<your_download_key>

sudo bash -c "cat <<EOF > /etc/yum.repos.d/Instana-Product.repo
[instana-product]
name=Instana-Product
baseurl=https://_:\${DOWNLOAD_KEY}@artifact-public.instana.io/artifactory/rel-rpm-public-virtual/
enabled=1
gpgcheck=0
gpgkey=https://_:\${DOWNLOAD_KEY}@artifact-public.instana.io/artifactory/api/security/keypair/public/repositories/rel-rpm-public-virtual
repo_gpgcheck=1
EOF"

sudo dnf clean expire-cache -y
sudo dnf install -y popctl
popctl --version
# → popctl version 0.2.3

Step 2 – K3s クラスターの作成

sudo popctl cluster create
# 対話プロンプトで Download Key を入力

Step 3 – containerd と レジストリの設定

K3s が使用する containerd の設定とレジストリ情報を確認・設定します。

sandbox_image の設定

sudo cp /var/lib/rancher/k3s/agent/etc/containerd/config.toml \
       /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl

sudo sed -i 's|sandbox_image = "artifact-public.instana.io/rancher/mirrored-pause:3.6"|sandbox_image = "docker.io/rancher/mirrored-pause:3.6"|' \
  /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl

確認:

sudo grep sandbox_image /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl
# → sandbox_image = "docker.io/rancher/mirrored-pause:3.6"

registries.yaml の設定

sudo bash -c "cat <<EOF > /etc/rancher/k3s/registries.yaml
mirrors:
  docker.io:
    endpoint:
      - https://registry-1.docker.io
configs:
  artifact-public.instana.io:
    auth:
      username: _
      password: \${DOWNLOAD_KEY}
  containers.instana.io:
    auth:
      username: _
      password: \${DOWNLOAD_KEY}
EOF"

K3s の再起動

sudo systemctl restart k3s
sleep 30

kube-system デプロイメントのイメージ設定

sudo kubectl set image deployment/coredns -n kube-system \
  coredns=docker.io/rancher/mirrored-coredns-coredns:1.10.1

sudo kubectl set image deployment/metrics-server -n kube-system \
  metrics-server=docker.io/rancher/mirrored-metrics-server:v0.7.0

sudo kubectl set image deployment/local-path-provisioner -n kube-system \
  local-path-provisioner=docker.io/rancher/local-path-provisioner:v0.0.26

確認:

sudo kubectl get pods -n kube-system
# → coredns, metrics-server, local-path-provisioner が全て Running

Step 4 – Synthetic PoP のデプロイ

sudo popctl up
# 対話プロンプトで以下を入力:
# - PoP Label(例: ibm-pop-tokyo)
# - Instana endpoint URL(例: https://mizu.instana.io/synthetics)
# - その他の設定項目

Step 5 – 動作確認

sudo kubectl get pods -A

全ての Pod が 1/1 Running になっていれば構築完了です。

NAMESPACE     NAME                                                          READY   STATUS
kube-system   coredns-xxxxxxxxxx-xxxxx                                      1/1     Running
kube-system   local-path-provisioner-xxxxxxxxxx-xxxxx                       1/1     Running
kube-system   metrics-server-xxxxxxxxxx-xxxxx                               1/1     Running
default       synthetic-pop-controller-xxxxxxxxxx-xxxxx                     1/1     Running
default       synthetic-pop-redis-xxxxxxxxxx-xxxxx                          1/1     Running
default       synthetic-pop-javascript-playback-engine-xxxxxxxxxx-xxxxx     1/1     Running
default       synthetic-pop-http-playback-engine-xxxxxxxxxx-xxxxx           1/1     Running
default       synthetic-pop-browserscript-playback-engine-xxxxxxxxxx-xxxxx  1/1     Running
default       synthetic-pop-ism-playback-engine-xxxxxxxxxx-xxxxx            1/1     Running

Step 6 – Browser Script テストの作成

Instana UI から外形監視テストを作成します。

  1. Synthetic Monitoring → + Add → Add Synthetic Test
  2. Test Type: Browser Script
  3. 以下のスクリプトを貼り付け:
const { assert } = require("chai");

(async function () {
  console.log("Access IBM website");
  await $browser.get("https://www.ibm.com");

  await $browser.wait($driver.until.titleContains("IBM"), 30000);
  let title = await $browser.getTitle();
  console.log("Page title:", title);
  assert.include(title, "IBM", "Page title should contain IBM");

  await $browser.takeScreenshot();
})();
  1. Location: 構築した PoP を選択
  2. Frequency: 5分
  3. Save

コンテナイメージ一覧(参考)

イメージ サイズ
synthetic-playback-browserscript 1.14 GB
synthetic-pop-controller 585 MB
synthetic-playback-http 275 MB
synthetic-playback-javascript 275 MB
synthetic-playback-ism 175 MB
redis 152 MB
合計 約 2.6 GB

まとめ

Amazon Linux 2023 上に popctl v0.2.3 で Instana Self-hosted Synthetic PoP を構築し、
Browser Script による外形監視テストまで実行できました。

構築後のディスク使用量は約 10 GB で、最低 20 GB あれば検証環境として十分です。

参考リンク

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?