1
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 EKSでPrometheusを利用する

1
Last updated at Posted at 2022-10-19

この記事でわかること

  • Amazon EKSでPrometheusを使う で扱う作業の全体像
  • 手順を進める前に確認したい前提
  • 今の環境で試すときに気をつけたい点

はじめに

Amazon EKSで Prometheus を利用する方法をまとめます。
Mac環境を想定しています。

実行環境の準備

  1. AWS CLIの設定
    AWS CloudFormationを動かすためのAWS CLIの設定を参考にしてください。

  2. EKSクラスタの構築
    Macでeksctlを利用してAmazon EKSのクラスターを構築するを参考にしてください。

  3. EKSのコンテキストの設定
    MacにてAmazon EKSの設定をするを参考にしてください。

  4. Helmの設定
    Amazon EKSでHelmを利用するを参考にしてください。

環境設定

  1. Prometheus のチャートをHelmでインストールする
    ※事前にKubernetesクラスターのコンテキストの設定をします。

    # Prometheus チャートリポジトリを追加する
    helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
    
    # Prometheus のチャートをインストールする
    helm upgrade -i prometheus prometheus-community/prometheus \
        --namespace prometheus \
        --set alertmanager.persistentVolume.storageClass="gp2",server.persistentVolume.storageClass="gp2" \
        --create-namespace
    
    # Prometheus がインストールされたことを確認する
    helm list -n prometheus
    
  2. Prometheus を起動する

    kubectl --namespace=prometheus port-forward deploy/prometheus-server 9090
    
  3. Prometheus にアクセスする

    open "http://localhost:9090"
    

クリーンアップ

  1. PrometheusをHelmで削除する

    helm delete prometheus -n prometheus
    
  2. Namespaceを削除する

    kubectl delete ns prometheus
    

参考

Prometheus を使用したプレーンメトリクスのコントロール

実務で使うときの確認ポイント

  • Kubernetes、EKS、関連コントローラーのバージョン差分を確認する。
  • kubectl の接続先、namespace、RBAC権限を確認してから実行する。
  • 検証後は不要なリソース、Load Balancer、ログ出力先、権限設定を整理する。
  • 本番反映前に公式ドキュメント、リリースノート、既存クラスタの運用ルールを確認する。

おわりに

ここまで読んでいただきありがとうございました。
Wealthy Designでは、AWS・Webシステム開発・AI活用など、現場で使える技術を大切にしています。

会社の取り組みは、会社サイトにまとめています。
https://wealthy-design.com/

1
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
1
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?