Quick Start Guide

Purpose

The Replex Kubernetes Agent collects metadata from the local cluster via the kubernetes API and metrics from a metric provider (a local Prometheus instance, Datadog, Stackdriver or Instana) and sends this information to the replex pushgateway which stores it for further use.

Requirements

  • A Kubernetes cluster to install the agent.

  • A metric provider. Either:

    • Prometheus instance that is running in the cluster and accessible via URL.

    • A thanos instance configured with a querier component

    • A Datadog account with API key and Application key provided.

    • A Stackdriver account.

    • An Instana account with an API token.

  • Helm 3 for the installation.

  • A replex token.

Required parameters for the installation

If only the Replex agent is to be used for data collection in the clusters, it must be installed in each individual cluster. The kubernetesInfoProvider parameter can be left at the default value of kubernetes.

The helm installation requires a few mandatory parameters:

Metric Provider Parameters

  • prometheus or thanos:

    Parameters prometheus.*Label allow overriding default labels in Prometheus installation. This will be the label that contains actual entity name in a Prometheus time-series like container_cpu_usage_seconds_total.

  • datadog:

    Note: Retrieve your Datadog keys from the Datadog settings page.

  • stackdriver:

  • instana:

Instana Single-Agent Setup

This section is relevant if you already use Instana to monitor your Kubernetes clusters. With a single deployment of the replex Agent, replex can pull all metrics and kubernetes information from the Instana API for all your clusters. This way, you don't need to install the replex Agent on all the clusters that you want to monitor costs for.

To activate this feature it is required to set the Helm parameter kubernetesInfoProvider to instana. Additionally, the Instana base URL (instana.baseUrl) and API Token (instana.apiToken) are required.

For the single agent setup, the cluster.id and cluster.name parameters should not be set since the agent automatically uses the cluster IDs from Instana.

Installation

  1. Add the Replex Helm repository

    helm repo add replex https://registry.replex.io/chartrepo/public
  2. Create a namespace to install the agent in

    kubectl create namespace replex-k8s-agent
  3. Create a file called values.yaml to specify Helm parameters. The file should look like this:

    • prometheus or thanos:

      cluster:
        id: <cluster-id>
        name: <cluster-name>
      replex:
        token: <replex-token>
      metrics:
        provider: prometheus
      prometheus:
        url: <prometheus-url>
        containerLabel: <prometheus-container-label>
        podLabel: <prometheus-pod-label>
        nodeLabel: <prometheus-node-label>
    • datadog:

      cluster:
        id: <cluster-id>
        name: <cluster-name>
      replex:
        token: <replex-token>
      metrics:
        provider: datadog
      datadog:
        apiKey: <datadog-api-key>
        applicationKey: <datadog-application-key>
        site: <datadog-site>
    • stackdriver:

      cluster:
        id: <cluster-id>
        name: <cluster-name>
      replex:
        token: <replex-token>
      metrics:
        provider: stackdriver
      stackdriver:
        projectId: <gcp-project-id>
    • instana:

      cluster:
        id: <cluster-id>
        name: <cluster-name>
      replex:
        token: <replex-token>
      metrics:
        provider: instana
      instana:
        baseUrl: <base-url>
        apiToken: <api-token>
  4. Installation with Helm

    helm install <release-name> replex/replex-k8s-agent --namespace replex-k8s-agent -f values.yaml

    Where release-name is any arbitrary string to identify the Helm installation e.g. replex-agent.

  5. Installation without Helm

    You will still need Helm to render the template locally. However, the installation itself will be done with kubectl directly, not with Helm:

    helm template replex replex/replex-k8s-agent --namespace replex-k8s-agent -f values.yaml | kubectl apply -f -

    After these steps the agent will start sending data to the pushgateway.

Updating

To update the agent, follow these steps:

  1. Update the Helm repo.

    helm repo update
  2. Upgrade the replex release.

    helm upgrade <release-name> replex/replex-k8s-agent --namespace <namespace> -f values.yaml

Logging

The replex-kubernetes-agent runs as a pod in the namespace it was installed in and its logs can be consulted using kubectl.

For example, kubectl -n replex-k8s-agent logs <pod-name>

Retry policy

Replex agent has a retry policy when one of metric push fails. By default, retry policy is turned on, so if one of metric pushes to Pushgateway fails, it will be stored on disk in persistentVolume.mountPath dir. If retry.diskCache is false, metrics will be stored in agents memory. retry.intervalSeconds stands for the interval when agent will try to resend metrics from the cache, by default it is 5 minutes (300s).

To set up retry policy next three variables can be used:

  • (Optional) retry.intervalSeconds: Interval between a retry to push metrics that failed previously.

  • (Optional) retry.diskCache: Cache failed metrics on disk.

  • (Optional) persistentVolume.mountPath: If retry.diskCache is true, path to store metrics.

Chart Values

Last updated