本文へスキップ

Whatap Operator インストール

このガイドでは、Kubernetes 環境に WhaTap Operator をインストールし、WhatapAgent CR を設定して WhaTap モニタリングを開始する方法について説明します。

インストール前の確認事項

  • Kubernetes クラスター(v1.19 以上)
  • Helm 3.2 以上
  • WhaTap アカウントおよびライセンスキー

インストール方法

次の手順に従って WhaTap Operator をインストールし、WhatapAgent CR を作成します。

  1. WhaTap Operator をインストールします。

    • 初めてエージェントをインストールするユーザーは、以下のコマンドを実行してください。
    helm repo add whatap https://whatap.github.io/helm/
    helm repo update
    kubectl create ns whatap-monitoring
    export WHATAP_HOST=<収集サーバーのIP>
    export WHATAP_LICENSE=<WhaTapライセンス>
    export WHATAP_PORT=<WhaTapポート>
    kubectl create secret generic whatap-credentials --namespace whatap-monitoring --from-literal WHATAP_LICENSE=$WHATAP_LICENSE --from-literal WHATAP_HOST=$WHATAP_HOST --from-literal WHATAP_PORT=$WHATAP_PORT
    helm install whatap-operator whatap/whatap-operator --namespace whatap-monitoring
    Tips

    高度な設定

    イメージレジストリとプルシークレット

    プライベートレジストリを使用する場合、またはイメージタグや pullPolicy を調整する必要がある場合は、values.yaml で次の値を設定します。

      image:
    repository: public.ecr.aws/whatap/whatap-operator
    tag: latest
    pullPolicy: Always

    # プライベートレジストリを使用する場合の設定
    imagePullSecret:
    name: <your-registry-secret-name>

    スケジューリング/優先度オプション

    オペレーターPodのスケジューリング制約と優先度を制御できます。値を指定した場合にのみテンプレートへレンダリングされ、既存ユーザーとの互換性が保たれます。

      priorityClassName: ""   # 例: system-cluster-critical
    nodeName: "" # 特定ノードへ固定スケジューリングが必要な場合
    nodeSelector: {} # 例: { kubernetes.io/os: linux }
    affinity: {} # 標準の K8s Affinity スキーマ
    tolerations: [] # 標準の K8s Toleration リスト
      priorityClassName: "high-priority"
    nodeSelector:
    nodepool: system

    affinity:
    nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
    nodeSelectorTerms:
    - matchExpressions:
    - key: kubernetes.io/os
    operator: In
    values: ["linux"]

    tolerations:
    - key: "node-role.kubernetes.io/control-plane"
    effect: NoSchedule

    デフォルトの values.yaml ではなくカスタム設定で使用する場合は、次のコマンドでオペレーターをインストールします。

    • すでにネームスペースがある場合

      helm install whatap-operator whatap/whatap-operator -n whatap-monitoring -f custom-values.yaml
    • ネームスペースがない場合は自動作成してインストール

      helm upgrade --install whatap-operator whatap/whatap-operator -n whatap-monitoring --create-namespace -f custom-values.yaml
    • 既存のWhaTap Kubernetesエージェントのユーザーは、次のコマンドを実行してエージェントをインストールします。
    kubectl delete ns whatap-monitoring
    kubectl delete clusterrole whatap
    kubectl delete clusterrolebinding whatap
    kubectl create ns whatap-monitoring
    kubectl create secret generic whatap-credentials --namespace whatap-monitoring --from-literal WHATAP_LICENSE=$WHATAP_LICENSE --from-literal WHATAP_HOST=$WHATAP_HOST --from-literal WHATAP_PORT=$WHATAP_PORT
    helm install whatap-operator whatap/whatap-operator --namespace whatap-monitoring
    ノート

    既存の yaml ファイルまたは helm 方式で WhaTap Kubernetes エージェントをインストールした場合、クリーンインストールが必要です。 既存の Kubernetes エージェントを削除した後、Operator の使用を推奨します。

    • Operator は Deployment としてデプロイされます。 以下のコマンドで Operator が正常にデプロイされたかを確認します。
    kubectl get pods -n whatap-monitoring | grep -i operator
    • コマンドの実行結果として、whatap-operator Pod が Running 状態である必要があります。

      whatap-operator-pod

  2. WhatapAgent CR を作成します。

    • 以下のコマンドで WhatapAgent カスタムリソースを作成します。
    kubectl apply -f values.yaml
    • WhatapAgent CR は、WhaTap エージェントのデプロイと構成を定義します。 K8s エージェント、APM の自動インストール、Open Agent を使用した OpenMetrics の収集を設定できます。

最小構成

基本的な Kubernetes モニタリングのために、Whatap マスターエージェントとノードエージェントを有効にする最小構成です。

values-min.yaml
apiVersion: monitoring.whatap.com/v2alpha1
kind: WhatapAgent
metadata:
name: whatap
spec:
features:
k8sAgent:
masterAgent:
enabled: true
nodeAgent:
enabled: true
gpuMonitoring:
enabled: false

最小構成でインストールすると、以下のように whatap-master-agent, whatap-node-agent が追加でインストールされます。

whatap-master-agent, whatap-node-agent

ノート

オペレーターで WhaTap エージェントをインストールする場合、CR 設定(リソース制約、tolerations、imagePullSecret)の詳細は WhaTap CR 設定オプション を参照してください。

基本構成


apiVersion: monitoring.whatap.com/v2alpha1
kind: WhatapAgent
metadata:
name: whatap
spec:
features:
### APM 自動インストールを使用する場合はコメントを解除 - アプリケーション Pod に APM エージェントを自動で注入し、アプリケーションのパフォーマンスをモニタリングします。
# apm:
# instrumentation:
# targets:
# - name: hello-world
# enabled: true
# language: "java" # 対応言語:: java, python, nodejs
# whatapApmVersions:
# java: "2.2.58" # 使用する APM エージェントバージョン
# namespaceSelector:
# matchNames:
# - default # モニタリング対象アプリケーションのあるネームスペース
# podSelector:
# matchLabels:
# app: "hello-world" # モニタリング対象アプリケーション Pod のラベル
# config:
# mode: default # APM エージェントモード設定

### K8s モニタリングを使用する場合はコメントを解除 - Kubernetes クラスター、ノード、コンテナのモニタリングを有効にします。
# k8sAgent:
# masterAgent:
# enabled: true # マスターエージェントを有効化(クラスター単位のメトリクス収集)
# nodeAgent:
# enabled: true # ノードエージェントを有効化(ノードおよびコンテナ単位のメトリクス収集)
### GPU モニタリング使用時はコメントを解除 - NVIDIA GPU メトリクス収集を有効にします。
# gpuMonitoring:
# enabled: true # GPU モニタリング有効化(NVIDIA DCGM-EXPORTER が whatap-node-agent サイドカーとしてインストールされます)

### OpenMetrics(Prometheus 形式のメトリクス収集)使用時はコメントを解除
# openAgent:
# enabled: true # OpenAgent 有効化
# targets:
# - targetName: kube-apiserver
# type: ServiceMonitor # 対象タイプ: ServiceMonitor, PodMonitor, StaticEndpoints
# namespaceSelector:
# matchNames:
# - "default" # メトリクスを収集するネームスペース
# selector:
# matchLabels:
# component: apiserver # メトリクスを収集するサービス/Pod のラベル
# provider: kubernetes
# endpoints:
# - port: "https" # メトリクスエンドポイントのポート
# path: "/metrics" # メトリクスパス
# interval: "30s" # スクレイピング間隔
# scheme: "https" # HTTP スキーム(http または https)
# tlsConfig:
# insecureSkipVerify: true # TLS 証明書検証をスキップ
# metricRelabelConfigs:
# - source_labels: ["__name__"]
# regex: "apiserver_request_total" # 収集対象のメトリクスフィルタ
# action: "keep" # 一致するメトリクスのみ保持

様々な構成例

WhaTapオペレーターは、対応するKubernetesエージェントの他に、APM自動インストール、カスタムメトリックエージェントのインストールをサポートしています。 以下の構成例を参考にインストールできます。

GPU モニタリング

Kubernetesモニタリングエージェントをインストールせず、WhaTapノードエージェントPodにDCGM-EXPORTERコンテナをサイドカーとしてデプロイします。 ユーザーは特別な構成を行わずに、以下の YAML を適用するだけで、収集されるメトリクスは GPU ダッシュボード で確認できます。

ノート

ノードエージェントに内蔵されたサイドカーではなく、直接 DCGM-EXPORTER を構成した場合は、OpenAgent(オープンエージェント)構成 ドキュメントを参照して dcgm OpenMetricsを収集することができます。

GPUモニタリング自動インストール

GPUモニタリング自動インストール
    apiVersion: monitoring.whatap.com/v2alpha1
kind: WhatapAgent
metadata:
name: whatap
spec:
features:
openAgent:
enabled: true # Open Agent 有効化
k8sAgent:
masterAgent:
enabled: true
nodeAgent:
enabled: true
gpuMonitoring:
enabled: true # GPUモニタリングを有効にします

参考,自動インストール時、Open Agentは自動的にDCGM Exporterを検出し、スクレイピングを行います。

GPUノードのトレランス設定

GPUノードにテイントがある場合は、トレランスを追加する必要があります。

GPUノードToleration設定
    apiVersion: monitoring.whatap.com/v2alpha1
kind: WhatapAgent
metadata:
name: whatap
spec:
features:
k8sAgent:
nodeAgent:
enabled: true
tolerations:
- key: "nvidia.com/gpu"
operator: "Exists"
effect: "NoSchedule"
- key: "gpu"
operator: "Exists"
effect: "NoSchedule"
gpuMonitoring:
enabled: true

APM自動インストール

Kubernetesモニタリングエージェントを有効にせず、Kubernetesクラスター内に存在するAPMを自動インストールします。

ノート

詳細はAPM自動インストール構成のドキュメントを参照してください。

APM自動インストール
apiVersion: monitoring.whatap.com/v2alpha1
kind: WhatapAgent
metadata:
name: whatap
spec:
features:
apm:
instrumentation:
targets:
- name: hello-world
enabled: true
language: "java"
whatapApmVersions:
java: "2.2.58"
namespaceSelector:
matchNames:
- default
podSelector:
matchLabels:
app: "hello-world"
config:
mode: default

OpenAgent

KubernetesモニタリングやAPM計測を有効にせず、Prometheusスタイルのメトリクスを収集するためのOpenAgentコンポーネントのみを構成します。

ノート

詳細はオープンエージェント構成のドキュメントを参照してください。

apiVersion: monitoring.whatap.com/v2alpha1
kind: WhatapAgent
metadata:
name: whatap
spec:
features:
openAgent:
enabled: true
targets:
- targetName: kube-apiserver
type: ServiceMonitor
namespaceSelector:
matchNames:
- "default"
selector:
matchLabels:
component: apiserver
provider: kubernetes
endpoints:
- port: "https"
path: "/metrics"
interval: "30s"
scheme: "https"
tlsConfig:
insecureSkipVerify: true
metricRelabelConfigs:
- source_labels: ["__name__"]
regex: "apiserver_request_total"
action: "keep"

KubernetesモニタリングとAPM計測を併用

apiVersion: monitoring.whatap.com/v2alpha1
kind: WhatapAgent
metadata:
name: whatap
spec:
features:
apm:
instrumentation:
targets:
- name: hello-world
enabled: true
language: "java"
whatapApmVersions:
java: "2.2.58"
namespaceSelector:
matchNames:
- default
podSelector:
matchLabels:
app: "hello-world"
config:
mode: default
k8sAgent:
masterAgent:
enabled: true
nodeAgent:
enabled: true
openAgent:
enabled: true
targets:
- targetName: kube-apiserver
type: ServiceMonitor
namespaceSelector:
matchNames:
- "default"
selector:
matchLabels:
component: apiserver
provider: kubernetes
endpoints:
- port: "https"
path: "/metrics"
interval: "30s"
scheme: "https"
tlsConfig:
insecureSkipVerify: true
metricRelabelConfigs:
- source_labels: ["__name__"]
regex: "apiserver_request_total"
action: "keep"