mcpField
I
infrastructure

infrastructure

github.com/grafanaクラウド・DevOps2954.4k 回インストール1 日前に更新
リポジトリ

infrastructure について

Kubernetes、ホスト、コンテナ、クラウドプロバイダーを対象にGrafana Cloudのインフラ監視を設定するスキルです。k8s-monitoring Helm chartやAlloyによる導入、状態確認、トラブルシューティングを説明します。

主な機能

  1. 01Helm chartによるKubernetes監視の導入
  2. 02Alloyによるホストメトリクス収集
  3. 03AWS・Azure・GCPデータソースの設定
  4. 04収集状態の確認と障害対応

活用シーン

  1. 01KubernetesクラスターをGrafana Cloudに接続
  2. 02Linuxホストのメトリクス収集
  3. 03AWS・Azure・GCPのメトリクス確認

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/grafana/skills --skill infrastructure

インストール後、Claude Code で/infrastructureを入力して読み込まれたか確認します。

同梱ファイルreferences/clouds-and-hosts.mdreferences/k8s-monitoring-values.md

詳細

Grafana Cloud インフラストラクチャ監視

ドキュメント: https://grafana.com/docs/grafana-cloud/monitor-infrastructure/

K8s、ホスト、コンテナ、クラウドプロバイダーのテレメトリーを、主に grafana/k8s-monitoring Helm チャートまたは Alloy 経由で収集します。

前提条件

  • Prometheus/Loki/Tempo のエンドポイントと API キー(metrics:write、logs:write、traces:write)を備えた Grafana Cloud スタック
  • Kubernetes の場合:クラスター、helm 3.x、およびそのクラスターを指す kubectl コンテキスト
  • ホスト/Docker の場合:ノードに Alloy がインストールされていること

一般的なワークフロー

1. Kubernetes クラスターをオンボーディングする(k8s-monitoring チャート)
# 1. Create the namespace + secret
kubectl create namespace monitoring
kubectl create secret generic grafana-cloud-secret \
  -n monitoring --from-literal=api-key=<your-api-key>

# 2. Install — values.yaml in references/k8s-monitoring-values.md
helm repo add grafana https://grafana.github.io/helm-charts && helm repo update
helm install k8s-monitoring grafana/k8s-monitoring \
  --version 4.1.4 -n monitoring -f values.yaml

# 3. Verify every pod is Running
kubectl get pods -n monitoring
# Expect alloy-*, kube-state-metrics-*, node-exporter-*, etc. all Ready.

# 4. Verify no error logs in the metrics/logs/traces Alloys
kubectl -n monitoring logs deploy/k8s-monitoring-alloy-metrics --tail=50 | grep -iE 'error|level=err' || echo "clean"

# 5. Verify telemetry landed in Grafana Cloud
#    PromQL on the metrics datasource (should be > 0):
#      sum(up{cluster="production-us-east"})
#    LogQL on Loki:
#      sum(count_over_time({cluster="production-us-east"}[5m]))

values.yaml の全設定、主要な PromQL、ダッシュボード ID(15520、1860、14282 など)、アラートルールについては、references/k8s-monitoring-values.md を参照してください。

2. Linux ホストを監視する
# 1. /etc/alloy/config.alloy — see references/clouds-and-hosts.md for the full block
prometheus.exporter.unix "host"  { rootfs_path = "/" }
prometheus.scrape         "node" { targets = prometheus.exporter.unix.host.targets
                                   forward_to = [prometheus.remote_write.cloud.receiver] }
# 2. Reload Alloy and verify the unix exporter is up
systemctl reload alloy
curl -s http://localhost:12345/api/v0/web/components | jq '.[] | select(.id|contains("prometheus.exporter.unix"))'

# 3. Verify in Grafana Cloud — open the "Node Exporter Full" dashboard (ID 1860)
#    and pick your host from the `instance` dropdown.
3. AWS/Azure/GCP のメトリクスを取得する

データソースをプロビジョニングしてから(完全な YAML は references/clouds-and-hosts.md を参照)、次を実行します。

# 1. After provisioning, restart Grafana to pick up the file
# 2. Verify the datasource — Grafana → Connections → Data sources → "Test"
#    Expect "Successfully queried the CloudWatch metrics API" (or equivalent).
# 3. Confirm a query — Explore → datasource → metric e.g.
#    CloudWatch namespace AWS/EC2 metric CPUUtilization, last 1h.

トラブルシューティング

  • チャートをインストールしたのに Cloud にメトリクスが表示されない → grafana-cloud-secret の api-key の値を確認してください。Alloy のログに 401 がないか確認してください
  • kube-state-metrics ポッドが Pending → RBAC が原因と考えられます。チャートの CRD/CRB を再適用してください
  • Node-exporter ポッドが CrashLoopBackOff → 通常は hostNetwork: true がホストの :9100 と競合しています。ポートを変更してください
  • CloudWatch の「Access denied」→ IAM ロールに cloudwatch:GetMetricData と cloudwatch:ListMetrics が不足しています

リソース

コメント