HELM グラフを使用した Red Hat OpenShift での Monitoring エージェントの管理
Helm チャートを使用して、 Kubernetes クラスター上の Monitoring エージェントをインストール、アップグレード、および削除できます。
開始前に
-
バージョン3の HelmCLIの最新リリースをローカルマシンにインストールします。
Helmは Kubernetesのパッケージマネージャで、Helmチャートを使ってクラスタ内の複雑なKubernetesアプリを定義、インストール、アップグレードする。 Helm チャートには、アプリを作成する Kubernetes リソースの YAML ファイルを生成するための指定内容がパッケージ化されています。 これらの Kubernetes リソースはクラスター内で自動的に適用され、Helm によってバージョンを割り当てられます。 Helm を使用して独自のアプリを指定およびパッケージ化して、Kubernetes リソースの YAML ファイルを Helm に生成させることもできます。
-
Monitoring エージェントをクラスターにデプロイするためのアクセス権限と権限があることを確認します。
-
ibm-observe
名前空間がクラスター内で使用可能であることを確認します。 エージェントはこの名前空間に配置される。
エージェントのデプロイ
Helmを使用してエージェントをデプロイするには、以下のステップを実行します。
ステップ 1. SysdigHelmリポジトリのセットアップ
Monitoringを追加します。HelmインスタンスにHelmリポジトリを追加します。
以下のステップを実行します。
-
クラスター・コンテキストを設定します。
obmcloud ks cluster config --cluster <CLUSTER_NAME>
-
Helmリポジトリを追加します。
helm repo add sysdig https://charts.sysdig.com
-
すべての Helm チャートの最新バージョンを取得するようにリポジトリーを更新します。
helm repo update
-
Sysdigレポで現在利用可能なHelmチャートを一覧表示します。
helm search repo sysdig
-
Helm チャート
sysdig/sysdig-deploy
がリストされていることを確認します。
以下のエラーを受け取る場合があります。
helm repo add sysdig https://charts.sysdig.com --debug
Error: context deadline exceeded
helm.go:84: [debug] context deadline exceeded
以下のコマンドを実行して、再試行してください。
rm $HOME/Library/Preferences/helm/repositories.lock
ステップ 2 値yamlファイルの作成
yaml ファイルを定義し、デプロイする Monitoring エージェントと Workload Protection コンポーネントをデプロイするための値を組み込みます。 例えば、ファイルに agent-values-monitor-secure.yaml
という名前を付けます。
以下の yaml は、 Monitoring エージェントおよび Workload Protection コンポーネントを構成するために使用できるテンプレートです。 このファイルをカスタマイズするには、エージェント・デプロイメントに不要なセクションを #
から削除するか、このセクションにコメントを付けます。
global:
clusterConfig:
name: CLUSTER_NAME
sysdig:
accessKey: MONITORING_INSTANCE_ACCESS_KEY
secureAPIToken: SECURE_TOKEN
kspm:
deploy: true
agent:
image:
tag: AGENT_TAG
registry: icr.io
slim:
enabled: true
image:
repository: ext/sysdig/agent-slim
kmoduleImage:
repository: ext/sysdig/agent-kmodule
collectorSettings:
collectorHost: INGESTION_ENDPOINT # for example, ingest.eu-gb.monitoring.cloud.ibm.com
nodeAnalyzer:
nodeAnalyzer:
deploy: true
apiEndpoint: API_ENDPOINT # for example, eu-gb.monitoring.cloud.ibm.com
benchmarkRunner:
deploy: false
kspmCollector:
apiEndpoint: API_ENDPOINT # for example, eu-gb.monitoring.cloud.ibm.com
admissionController:
enabled: true
sysdig:
url: WEB_UI_ENDPOINT # for example, https://ingest.eu-gb.monitoring.cloud.ibm.com
clusterName: CLUSTER_NAME
説明
CLUSTER_NAME
は、エージェントをデプロイしているクラスターの名前です。MONITORING_INSTANCE_ACCESS_KEY
は Monitoring インスタンスのアクセス・キーです。SECURE_TOKEN
は Secure API トークンです。AGENT_TAG
は、デプロイする予定のエージェントのバージョンです。INGESTION_ENDPOINT
は、インスタンスの取り込みエンドポイントです。API_ENDPOINT
は、インスタンスの API エンドポイントです。WEB_UI_ENDPOINT
は、インスタンスの Web UI エンドポイントです。
エージェントをデプロイするための値 yaml ファイルのサンプル
例えば、 Monitoring エージェントのみをデプロイする値ファイルの以下のサンプルを参照してください。
global:
clusterConfig:
name: mycluster-au-syd
sysdig:
accessKey: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
secureAPIToken: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
kspm:
deploy: true
agent:
image:
registry: icr.io
slim:
enabled: true
image:
repository: ext/sysdig/agent-slim
kmoduleImage:
repository: ext/sysdig/agent-kmodule
collectorSettings:
collectorHost: ingest.au-syd.monitoring.cloud.ibm.com
エージェントおよび Node Analyzer をデプロイするための値 yaml ファイルのサンプル
例えば、 Monitoring エージェントと Node Analyzer コンポーネントをデプロイする値ファイルの以下のサンプルを参照してください。
global:
clusterConfig:
name: mycluster-au-syd
sysdig:
accessKey: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
secureAPIToken: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
kspm:
deploy: true
agent:
image:
registry: icr.io
slim:
enabled: true
image:
repository: ext/sysdig/agent-slim
kmoduleImage:
repository: ext/sysdig/agent-kmodule
collectorSettings:
collectorHost: ingest.au-syd.monitoring.cloud.ibm.com
nodeAnalyzer:
nodeAnalyzer:
deploy: true
apiEndpoint: API_ENDPOINT # for example, eu-gb.monitoring.cloud.ibm.com
benchmarkRunner:
deploy: false
ステップ 3。 Helm チャートのインストール
エージェント、 Workload Protection コンポーネント、またはその両方をデプロイするには、 sysdig/sysdig-deploy
チャートをインストールし、前のステップで構成した変数 yaml ファイルを使用する必要があります。
helm チャートを使用してエージェントをインストールするには、以下のコマンドを実行します。
helm install -n ibm-observe sysdig-agent sysdig/sysdig-deploy -f agent-values-monitor-secure.yaml
エラー Error: INSTALLATION FAILED: Kubernetes cluster unreachable: xxxxxx failed to refresh token: oauth2: cannot fetch token: 400 Bad Request
が発生した場合は、クラスター・コンテキストを設定して再試行してください。
エージェントの更新
Helmを使用してエージェント・バージョンを更新するには、以下の手順を実行します。
-
チャートを更新します。
helm repo update
-
エージェントをデプロイするために使用した値 yaml ファイルを見つけ、デプロイするエージェントのバージョンに合わせて
agent.image.tag
を変更します。 -
エージェントをアップグレードします。
helm upgrade -n ibm-observe sysdig-agent sysdig/sysdig-deploy -f agent-values-monitor-secure.yaml
エージェントの削除
Helmを使用してエージェントを削除するには、チャートをアンインストールする必要があります。
以下のステップを実行します。
-
インストールされているチャートをリストアップする。
helm list -n ibm-observe
コマンドの出力は以下のようにチャートを一覧表示する:
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION sysdig-agent ibm-observe 1 2023-03-24 15:02:58.408108 +0100 CET deployed sysdig-deploy-1.6.3
-
チャートをアンインストールします。
helm delete sysdig-agent -n ibm-observe
Helmの用語では、
sysdig-agent
はリリースの名前です。コマンドに名前空間を含めるのを忘れた場合は、次のエラーが発生します:
Error: uninstall: Release not loaded: sysdig-agent: release: not found
。