Skip to main content

Helmチャートを使用したエージェントオペレータのセットアップ

Helmは、Kubernetesのパッケージマネージャーで、Kubernetesアプリケーションの管理に活用できるツールです。Helmでは「チャート」を使用して、Kubernetesオペレータの設定、インストール、アップグレードなどを行います。Contrastエージェントオペレータは、Helmチャートを使用してのセットアップを推奨します。

開始する前に

開始する前に、必要なものが揃っているか事前に確認してください。

手順

  1. 以下のHelmコマンドを実行して、YAMLファイルを作成します。

    helm repo add contrast https://contrastsecurity.dev/helm-charts
    helm repo update contrast
    helm show values contrast/contrast-agent-operator > contrast-agent-operator.yaml
  2. YAMLファイルのclusterDefaultsセクションにエージェントキーを追加します。また、enabled:プロパティをtrueに設定する必要があります。

    clusterDefaults:
      enabled: true
      tokenValue: <YourContrastToken>
      yaml: |-
        enable: true
  3. 以下のHelmコマンドを実行します。

    helm upgrade --install --namespace contrast-agent-operator --create-namespace -f contrast-agent-operator.yaml contrast-agent-operator contrast/contrast-agent-operator

    Helm NOTESには、次の例に示すように、ワークロードに適用するラベルの詳細が含まれます。

    Release "contrast-agent-operator" does not exist. Installing it now.
    NAME: contrast-agent-operator
    LAST DEPLOYED: Mon Apr  6 16:08:43 2026
    NAMESPACE: contrast-agent-operator
    STATUS: deployed
    REVISION: 1
    TEST SUITE: None
    NOTES:
    contrast-agent-operator chart version 6.0.0 deployed!
    ✅ 6 cluster agent injectors have been deployed for namespace: default
      To label additional namespaces for injectors:
    
        ⎈ kubectl label namespace/<YourNamespaceName> agents.contrastsecurity.com/agent-injectors=true
    
      To label workloads:
    
      contrast-java-injector (java):
        ⎈ kubectl label deployment/<YourDeploymentName> contrast-agent=java
    
      contrast-dotnet-core-injector (dotnet-core):
        ⎈ kubectl label deployment/<YourDeploymentName> contrast-agent=dotnet-core
    
      contrast-nodejs-injector (nodejs):
        ⎈ kubectl label deployment/<YourDeploymentName> contrast-agent=nodejs
    
      contrast-php-injector (php):
        ⎈ kubectl label deployment/<YourDeploymentName> contrast-agent=php
    
      contrast-python-injector (python):
        ⎈ kubectl label deployment/<YourDeploymentName> contrast-agent=python
    
      contrast-flex-injector (flex):
        ⎈ kubectl label deployment/<YourDeploymentName> contrast-agent=flex
    
    
    ⚠️  clusterDefaults.enabled was false, so no agent connections deployed. Enable this and provide agent credentials for easier deployment via this chart, or refer to documentation here to manually create them: https://docs.contrastsecurity.com/en/agent-operator-configuration.html#clusteragentconnection or https://docs.contrastsecurity.com/en/agent-operator-configuration.html#agentconnection
    
    👀 To watch the operator logs:
        ⎈ kubectl logs -f -l app.kubernetes.io/part-of=contrast-agent-operator --namespace contrast-agent-operator
    
    📄 More documentation: https://docs.contrastsecurity.com/en/agent-operator.html
    
    🙋 Get support: https://support.contrastsecurity.com / support@contrastsecurity.com
  4. 一覧表の値を使用して、デプロイメントにラベルを付けます。

    ヒント

    kubectl get deploymentsコマンドを実行して、デプロイメント名を確認することもできます。

    デプロイメントにラベルを付ける場合のコマンド例:

    実行:

    kubectl get deployments

    実行結果(例):

    NAME                READY   UP-TO-DATE   AVAILABLE   AGE
    app1-deployment     0/3     0            0           1s

    そして、以下のコマンドを実行:

    kubectl label deployment app1-deployment contrast-agent=java

    YAMLファイルのデフォルト設定では、 AgentInjectorは defaultのネームスペースにのみデプロイされます。他のネームスペースを使う場合、YAMLファイルのagentInjectors.namespaces配列に追加できます。

    次の例は、agentInjectors.namespaces配列を設定する方法を示しています。

    agentInjectors:
      enabled: true
      # Optional, target namespaces for AgentInjectors.
      namespaces:
        - default
      injectors:
        ...