Skip to main content

Set up Agent Operator with Helm charts

Helm is a package manager for Kubernetes that helps manage Kubernetes applications. Helm uses charts to configure, install, and upgrade Kubernetes Operators. This is the recommended method of installation.

Before you begin

Make sure you have everything you need before you start:

Steps

Note

The default configuration from the YAML file deploys AgentInjectors only to the default namespace. If other namespaces are used, these can be added to the agentInjectors.namespaces array in the YAML file.

  1. Create a values file based on the latest version of the YAML file found here.

  2. Name it contrast-agent-operator.yaml.

  3. Add agent keys to the clusterDefaults section of the YAML file. You will also need to set the enabled: property to true.

    clusterDefaults:
      enabled: true
      url: YOUR_CONTRAST_URL
      apiKeyValue: YOUR_API_KEY
      serviceKeyValue: YOUR_AGENT_SERVICE_KEY
      userNameValue: YOUR_AGENT_USERNAME
      yaml: |-
        enable: true
  4. Label your deployments by using the values from the table.

    Tip

    Run the kubectl get deployments command to also find the deployment names.

    Example commands for labeling a deployment:

    Run:

    kubectl get deployments

    Get an output (for example):

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

    Then run the following command:

    kubectl label deployment app1-deployment contrast-agent=java
  5. Run the following Helm commands:

    helm repo add contrast https://contrastsecurity.dev/helm-charts
    helm repo update contrast
    helm upgrade --install -f contrast-agent-operator.yaml contrast-agent-operator contrast/contrast-agent-operator
    

Note

If the YAML file is edited any time after this setup, you will need to repeat the helm upgrade command from step 5 to update the Operator configuration.