Amazon EC2 を使用したベアメタル K8s での PSA の設定
次のように、Amazon EC2 を使用して、ベアメタル K8s での Web モニタリング PSA と API モニタリング PSA を設定します。既存の Kubernetes クラスタで PSA を設定する場合は、「Kubernetes クラスタの作成」セクションをスキップします。
- Kubernetes クラスタを作成します。
- Docker イメージをプルします。
- Minikube の Docker デーモンにイメージを保存します。
- Web モニタリング PSA と API モニタリング PSA を展開します。
- Kubernetes クラスターをモニターします。
Kubernetes クラスタの作成
Bare Metal K8s で Kubernetes クラスタを作成するには、次の手順を実行します。
Kubernetes クラスタにアクセスするには、次の手順に従って、クラスタとの対話型ユーティリティである kubectl をインストールします。
クラスタが実行されていることを確認するには、次のように入力します。
kubectl get nodes
(オプション)プロキシサーバーの設定
プロキシサーバーを設定すると、すべてのドメインに適用されます。values.yaml ファイルにプロキシサーバーアドレスを指定して、プロキシサーバーを設定します。「キーと値のペアの設定」を参照してください。
プロキシサーバーからドメインをバイパスするには、次の手順を実行します。
Docker イメージのプル
DockerHub から sum-chrome-agent、sum-api-monitoring-agent、sum- heimdall の既成の Docker イメージをプルします。既成イメージには依存ライブラリが含まれているため、インターネットにアクセスできない場合でもこれらのイメージを使用できます。
次のコマンドを実行して、エージェントイメージをプルします。
docker pull appdynamics/heimdall-psa
docker pull appdynamics/chrome-agent-psa
docker pull appdynamics/api-monitoring-agent-psa(オプション)カスタム Python ライブラリの追加
使用可能な標準ライブラリセットに加えて、スクリプト測定で使用するカスタム Python ライブラリをエージェントに追加できます。ベースイメージとしてロードしたイメージに基づいて新しいイメージをビルドします。
Dockerfile を作成し、Python pip を実行する
RUNディレクティブを作成します。たとえば、algorithmsライブラリをインストールするには、次のように Dockerfile を作成できます。# Use the sum-chrome-agent image you just loaded as the base image FROM appdynamics/chrome-agent-psa:<agent-tag> USER root RUN apk add py3-pip USER appdynamics # Install algorithm for python3 on top of that RUN python3 -m pip install algorithms==0.1.4 --break-system-packages注: 任意の数の ディレクティブを作成して、必要なライブラリをインストールできます。新しいイメージをビルドするには、次のように入力します。
docker build -t sum-chrome-agent:<agent-tag> - < Dockerfile新しくビルドされたエージェントイメージには、必要なライブラリが含まれています。
Tag and Push Images to the Registry
You must tag and push the images to a registry for the cluster to access it. It can be done in the following ways:
Bare Metal K8S using EC2
Vanilla K8S runs on AWS infrastructure. As kops create and assign appropriate roles to the cluster nodes, they can directly access Elastic Container Registry (ECR), without any other configuration.
To tag images, enter:
Web Monitoring PSA:
docker tag sum-heimdall:<heimdall-tag> <aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-heimdall:<heimdall-tag>
docker tag sum-chrome-agent:<agent-tag> <aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-chrome-agent:<agent-tag>
API Monitoring PSA:
docker tag sum-heimdall:<heimdall-tag> <aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-heimdall:<heimdall-tag>
docker tag sum-api-monitoring-agent:<agent-tag> <aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-api-monitoring-agent:<agent-tag>
Replace <aws_account_id> and <region> with your account and region values.
To create repositories, enter:
Web Monitoring PSA:
aws ecr create-repository --repository-name sum/sum-heimdall
aws ecr create-repository --repository-name sum/sum-chrome-agent
API Monitoring PSA:
aws ecr create-repository --repository-name sum/sum-heimdall
aws ecr create-repository --repository-name sum/sum-api-monitoring-agent
To push the images, enter:
Web Monitoring PSA:
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin <aws_account_id>.dkr.ecr.<region>.amazonaws.com
docker push <aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-heimdall:<heimdall-tag>
docker push <aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-chrome-agent:<agent-tag>
API Monitoring PSA:
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin <aws_account_id>.dkr.ecr.<region>.amazonaws.com
docker push <aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-heimdall:<heimdall-tag>
docker push <aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-api-monitoring-agent:<agent-tag>
Bare Metal K8S using Private Registry
To tag images, enter:
Web Monitoring PSA:
docker tag sum-heimdall:<heimdall-tag> <REGISTRY_HOST>:<REGISTRY_PORT>/sum-heimdall:<heimdall-tag>
docker tag sum-chrome-agent:<agent-tag> <REGISTRY_HOST>:<REGISTRY_PORT>/sum-chrome-agent:<agent-tag>
API Monitoring PSA:
docker tag sum-heimdall:<heimdall-tag> <REGISTRY_HOST>:<REGISTRY_PORT>/sum-heimdall:<heimdall-tag>
docker tag sum-api-monitoring-agent:<agent-tag> <REGISTRY_HOST>:<REGISTRY_PORT>/sum-api-monitoring-agent:<agent-tag>
Replace <REGISTRY_HOST> and <REGISTRY_PORT> to what you configured while deploying the registry.
To push the images, enter:
Web Monitoring PSA:
docker login <REGISTRY_HOST>:<REGISTRY_PORT>
docker push <REGISTRY_HOST>:<REGISTRY_PORT>/sum-heimdall:<heimdall-tag>
docker push <REGISTRY_HOST>:<REGISTRY_PORT>/sum-chrome-agent:<agent-tag>
API Monitoring PSA:
docker login <REGISTRY_HOST>:<REGISTRY_PORT>
docker push <REGISTRY_HOST>:<REGISTRY_PORT>/sum-heimdall:<heimdall-tag>
docker push <REGISTRY_HOST>:<REGISTRY_PORT>/sum-api-monitoring-agent:<agent-tag>
Deploy the Web Monitoring PSA and API Monitoring PSA
The application is deployed to the cluster after the images are in the Registry. You use the Helm chart to deploy and create all Kubernetes resources in the required order.
Kubernetes クラスタのモニタリング
ダウンロードした zip 内の Helm チャート sum-psa-monitoring.tgz により、モニタリングスタックがインストールされます。この Helm チャートは、Private Simple Synthetic Agent をモニタするためのカスタム Grafana ダッシュボードとともに kube-prometheus-stack をインストールします。
Install the Monitoring Stack
To create a separate
monitoringnamespace, enter:
To review configuration options, enter:kubectl create namespace monitoring
This generates ahelm show values sum-psa-monitoring.tgz > values-monitoring.yamlvalues-monitoring.yamlfile that contains all the configuration options. To modify and pass the generatedvalues-monitoring.yamlfile while installing the Helm chart, enter:helm install psa-monitoring sum-psa-monitoring.tgz --values values-monitoring.yaml --namespace monitoring-
After the monitoring stack is installed, you can Launch Grafana (which runs inside the cluster) to view the dashboard. To access Grafana from outside of the cluster, you can configure port forwarding or set up Ingress. To configure port forward to access it locally, enter:
kubectl port-forward svc/psa-monitoring-grafana 3000:80 --namespace monitoring -
Launch localhost:3000 from the browser and log in using the default credentials with username as
adminand password asprom-operator. A dashboard named Private Simple Synthetic Agent displays and provides details about the Kubernetes cluster, Apache Ignite, Heimdall, and running measurements.
Bare Metal K8s での Private Synthetic Agent のアップグレード
プライベート合成エージェントのアップグレード
PSA をアップグレードするには、次の手順を実行します。
Docker イメージのプル
DockerHub から sum-chrome-agent、sum-api-monitoring-agent、sum- heimdall の既成の Docker イメージをプルします。既成イメージには依存ライブラリが含まれているため、インターネットにアクセスできない場合でもこれらのイメージを使用できます。
次のコマンドを実行して、エージェントイメージをプルします。
docker pull appdynamics/heimdall-psa
docker pull appdynamics/chrome-agent-psa
docker pull appdynamics/api-monitoring-agent-psa
カスタム Python ライブラリの追加
この手順は任意です。使用可能な標準ライブラリセットに加えて、スクリプト測定で使用するカスタム Python ライブラリをエージェントに追加できます。ベースイメージとしてロードしたイメージに基づいて新しいイメージをビルドします。
-
Dockerfile を作成し、
pythonpipを実行するRUNディレクティブを作成します。たとえば、algorithmsライブラリをインストールするには、次のように Dockerfile を作成できます。# Use the sum-chrome-agent image you just loaded as the base image FROM appdynamics/chrome-agent-psa:<agent-tag> USER root RUN apk add py3-pip USER appdynamics # Install algorithm for python3 on top of that RUN python3 -m pip install algorithms==0.1.4 --break-system-packages注: 任意の数の ディレクティブを作成して、必要なライブラリをインストールできます。 新しいイメージを作成するには、次のコマンドを実行します。
Web モニタリング PSA:
API モニタリング PSA:docker build -t sum-chrome-agent:<agent-tag> - < Dockerfile
Kubernetes クラスタノードと同じ OS タイプのホストでイメージをビルドする必要があります。たとえば、イメージを AWS にプッシュする場合は、次のコマンドを実行します。docker build -f Dockerfile-PSA -t sum-api-monitoring-agent:<agent-tag> .
新しくビルドされたエージェントイメージには、必要なライブラリが含まれています。docker buildx build -f Dockerfile-PSA --platform=linux/amd64 -t sum-api-monitoring-agent:<api-tag> .
イメージのタグ付けとレジストリへのプッシュ
独自の Kubernetes クラスタを管理している場合は、独自のレジストリサーバーを展開する必要があります。詳細については、「レジストリサーバーの展開」を参照してください。レジストリを展開したら、イメージにタグを付けてプッシュします。
<REGISTRY_HOST> と <REGISTRY_PORT> を、レジストリの展開中に使用した値に置き換えます。イメージにタグを付けるには、次のように入力します。
docker tag sum-heimdall:<heimdall-tag> <REGISTRY_HOST>:<REGISTRY_PORT>/sum-heimdall:<heimdall-tag>
docker tag sum-chrome-agent:<agent-tag> <REGISTRY_HOST>:<REGISTRY_PORT>/sum-chrome-agent:<agent-tag>
docker tag sum-api-monitoring-agent:<agent-tag> <REGISTRY_HOST>:<REGISTRY_PORT>/sum-api-monitoring-agent:<agent-tag>
イメージをプッシュするには、次のように入力します。
docker login <REGISTRY_HOST>:<REGISTRY_PORT> docker push <REGISTRY_HOST>:<REGISTRY_PORT>/sum-heimdall:<heimdall-tag>
docker push <REGISTRY_HOST>:<REGISTRY_PORT>/sum-chrome-agent:<agent-tag>
docker push <REGISTRY_HOST>:<REGISTRY_PORT>/sum-api-monitoring-agent:<agent-tag>
Helm チャートの更新
次の手順に従って、values.yaml ファイル内の設定キーと値のペアを更新します。
PSA のアップグレード
-
新しい Linux ディストリビューション フォルダに移動して、次のコマンドを実行します。
helm install synth ignite-psa.tgz --values values-ignite.yaml --namespace measurement -
Ignite ポッドのステータスが
runningに変わるまで待ちます。その後、次のコマンドを実行します。helm upgrade heimdall-onprem sum-psa-heimdall.tgz --values values.yaml --namespace measurement -
新しい Heimdall ポッドと Ignite ポッドのステータスが
runningに変更されたら、古い Ignite 名前空間をアンインストールします。helm uninstall synth -n ignite