アプリケーションのビルドとデプロイ

K8sへのデプロイ

10 minutes

このステップでは、Helmを使用してSplunk Distribution of the OpenTelemetry Collectorをk3dクラスターにデプロイします。

Kubernetesへのデプロイ

プロジェクトルート [~/workshop/context-propagation] から以下を実行します

bash
make deploy

このスクリプトは以下を実行します

  1. deploy/k8s/ にあるすべてのKubernetesマニフェストを適用する
  2. .env の認証情報から splunk-otel Secretを作成する
  3. デプロイメントをレジストリイメージに紐付ける
  4. すべてのロールアウトが完了するまで待機する

検証チェックリスト - デプロイ

1. すべてのPodが実行中であることを確認

bash
kubectl -n cosmic-shop get pods

2. ServiceとNodePortの確認

bash
kubectl -n cosmic-shop get svc

3. バックエンドのヘルスエンドポイントの確認

bash
kubectl -n cosmic-shop exec deploy/frontend-api -- wget -qO- http://localhost:3007/health
kubectl -n cosmic-shop exec deploy/catalog-api -- wget -qO- http://localhost:3002/health
kubectl -n cosmic-shop exec deploy/order-api -- wget -qO- http://localhost:3001/health

4. ショップUIの応答確認

bash
curl -s -o /dev/null -w "HTTP %{http_code}\n" http://localhost:30080/
curl -s http://localhost:30080/ | head -5

5. Gateway経由でAPIカタログエンドポイントの確認

bash
curl -s http://localhost:30080/api/catalog | python3 -m json.tool | head -20

6. RabbitMQ管理UIの確認

RabbitMQ Serviceは NodePort 15672 を使用しており、k3dがロードバランサーを通じて管理UIを公開できるようになっています。

k3dロードバランサーがポート15672をマッピングしていることを確認

bash
docker ps --filter name=k3d-cosmic-shop-serverlb --format '{{.Ports}}'

HTTPの応答確認

bash
curl -s -o /dev/null -w "HTTP %{http_code}\n" http://localhost:15672/

RabbitMQへのログイン(任意)

ブラウザで http://(your-instance-url):15672 を開き、guest / guest でログインします。

RabbitMQ UIが読み込めない場合別のターミナル でport-forwardを実行します(開いたままにしてください)

bash
kubectl -n cosmic-shop port-forward svc/rabbitmq 15672:15672

その後、再度 http://(your-instance-url):15672 を開きます。

Last Modified ·