KOP Recipes - Amazon Managed Prometheus (AMP) - Configure - Rafay Product Documentation

Configure

In this part, you will


Step 1: AMP Workspace

In the example below, we have created our AMP workspace called "amp-demo" in the "us-east-1" AWS region.


Step 2: IRSA

In this step, you will create an IRSA so that the Prometheus pods on the EKS cluster will have the necessary permissions to perform "remote writes" to the AMP remote write endpoint. In AWS, it is a recommended best practice to use IAM roles for service accounts (IRSA) to access AWS services outside the EKS cluster because of the following benefits:

Benefit Description
Least Privilege No longer need to provide extended permissions to the node IAM role so that pods on that node can call AWS APIs. You can scope IAM permissions to a service account, and only pods that use that service account have access to those permissions. This feature also eliminates the need for third-party solutions such as kiam or kube2iam.
Credential Isolation A container can only retrieve credentials for the IAM role that is associated with the service account to which it belongs. A container never has access to credentials that are intended for another container that belongs to another pod.
Auditability Access and event logging is available through CloudTrail to help ensure retrospective auditing.

Create Namespace

We will deploy Prometheus to a namespace called "monitoring"


Create IRSA

In the example below, the EKS cluster's name is "amp-demo" and the IRSA name is "amp-irsa".

./rctl create iam-service-account amp-demo --name amp-irsa --namespace monitoring --policy-arn arn:aws:iam::aws:policy/AmazonPrometheusRemoteWriteAccess

Request submitted successfully to create IAM service account(s).

Verify IRSA

Creation of the IRSA can take a few seconds. You can verify the status of the IRSA by using RCTL

./rctl get iam-service-account amp-demo

[{"metadata":{"name":"amp-irsa","namespace":"monitoring"},"attachPolicyARNs":["arn:aws:iam::aws:policy/AmazonPrometheusRemoteWriteAccess"]}]

You can also verify that the k8s service account was created in the EKS cluster in the "monitoring" namespace.

kubectl get sa -n monitoring

NAME       SECRETS   AGE
amp-irsa   1         2m33s
default    1         18m

As you can see in this example, the "amp-irsa" service account was successfully created in the "monitoring" namespace.


Step 3: Cluster Blueprint

In this step, you will


Add Prometheus Repo

Configure the Prometheus repo endpoint so that the controller can automatically retrieve the required Helm chart directly from the Internet facing repository.


Create Addon


Custom Values

We need to customize the Prometheus addon with an override "values file" comprising the following:

  1. The IRSA for Prometheus to perform remote writes to the AMP endpoint

  2. The AMP remote write endpoint URL details (from AWS Console)

  3. The AWS region for the AMP workspace

  4. Save the YAML provided below to a file and update the fields appropriately.

  5. Add the values.yaml file to the addon as an override.

rbac:
  create: true
serviceAccounts:
  server:
    create: false
    name: <EKS cluster's IRSA>
alertmanager:
  enabled: false
alertmanagerFiles:
  alertmanager.yml: ""
kubeStateMetrics:
  enabled: false
nodeExporter:
  enabled: false
pushgateway:
  enabled: false
server:
  remoteWrite:
    - url: <AMP Remote Write URL>
      sigv4:
        region: <AWS Region for the AMP workspace>
      queue_config:
        max_samples_per_send: 1000
        max_shards: 200
        capacity: 2500

New Addon Version


New Blueprint


Step 4: Apply Blueprint

Now, we are ready to apply the newly created, custom blueprint to our EKS cluster.

In a few minutes, all the k8s resources matching the custom cluster blueprint will become operational on the cluster. Notice that the cluster's blueprint name and version match what you created in the prior step.


Step 5: Verify Setup

Optionally, to verify if Prometheus is able to remote write to the AMP workspace


You are now ready to move on to the next part of the recipe where you will access and visualize the time series data aggregated in your AMP Workspace using Grafana.