Skip to main content
All CollectionsUniskai and Kubernetes
Connecting EKS cluster API’s description
Connecting EKS cluster API’s description
Updated today

Step 1.

Firstly, you should generate API_KEY in the Uniskai platform. The API key can be reused, but it will expire on the date you select.

How to generate API Key:

● Go to the settings of the desired account in the Account Manager

● Go to the Api Access tab

● Generate the API Key for some period of time

● Save the value of API Key (Important save for the future because you can not retrieve it later)

● Save the Environment ID value (you will need it)

Step 2.

Use the previous step's API key and Environment ID to collect all clusters in your account and find the desired cluster from the response.

Example of the code

ENV_ID = your_env_id
API_KEY = your_api_key
headers = {
'content-type': 'application/json',
"Authorization": f"Api-Key {API_KEY}"
}
all_clusters = session.get(f'https://profisealabs.com/api/kubernetes/clusters?env={ENV_ID}', headers=headers)


Request explanation:

GET request 'https://profisealabs.com/api/kubernetes/clusters?env={ENV_ID}' — Will collect all clusters in your account.

Response example:

{
"environment_id": 8627,
"data": {
"clusters": [
{
"account_id": "1111111111",
"cluster": {
"type": "eks-cluster",
"identification": {
"provider": "aws",
"arn": "arn:aws:eks:us-east-1:1111111111:cluster/test-1",
"region": "us-east-1"
},
"name": "test-1"
},
"connections": [
{
"type": "container-insights",
"mode": "reader",
"status": "connected",
"locked": false
},
{
"type": "api",
"mode": "reader",
"status": "not-connected",
"locked": false
},
{
"type": "agent",
"mode": "editor",
"status": "not-connected",
"locked": false
}
],
"status": "connected",
"mode": "reader",
"is_connected": true
},
{
"account_id": "1111111111",
"cluster": {
"type": "eks-cluster",
"identification": {
"provider": "aws",
"arn": "arn:aws:eks:eu-central-1:1111111111:cluster/test_2",
"region": "eu-central-1"
},
"name": "test_2"
},
"connections": [
{
"type": "container-insights",
"mode": "reader",
"status": "connected",
"locked": false
},
{
"type": "api",
"mode": "reader",
"status": "not-connected",
"locked": false
},
{
"type": "agent",
"mode": "editor",
"status": "not-connected",
"locked": false
}
],
"status": "connected",
"mode": "reader",
"is_connected": true
}
]
}
}

Step 3.

You should connect OTEL to your cluster (in this step you do not need Uniskai)

How to Install AWS OTEL agent.

To set up Container Insights on Amazon EKS, you can either follow the
AWS installation guidelines or proceed with the following steps:

  1. Set up the command line environment to access the EKS cluster control plane. The easiest method is to launch an AWS CloudShell in your preferred region. You can use this link to run AWS CloudShell.

  2. Set the cluster name and region variables. Replace “region-code” with the AWS region code where your cluster is located and “cluster-name” with the name of your cluster:

    export CLUSTER=cluster-name
    export REGION=region-code

  3. Install AWS OTEL Agent by running this command:

    curl https://uniskai-eu-templates.s3.amazonaws.com/eks/install-otel-container-insights.sh | bash -s

  4. After a successful installation, the OTEL Agent may take up to 15 minutes to deploy and export performance metrics.

Step 4.

Trigger the refresh request for cluster connection

POST request

https://profisealabs.com/api/environments/{ENV_ID}/kubernetes/cluster-connection/refresh – Will trigger the refresh request for cluster connection

Payload example:

{
"cluster_id": "arn:aws:eks:eu-west-3:779846814222:cluster/test_cluster_for_everyone",
"mode": "reader"
}

You can obtain the cluster ID from the GET request to the clusters endpoint from step 3.

Step 5.

Get cluster token using the next endpoints

Payload example:

{
"cluster_id": "arn:aws:eks:eu-west-3:779846814222:cluster/test_cluster_for_everyone",
"mode": "reader"
}

Receive token from the response

Response example:

{
"agent": {
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6ImJqMWhjbTQ2WVhkek9tVnJjenBsZFMxalpXNTBjbUZzTFRFNk9UQTRNREkzTkRBek9UWXAFJISDJOFIrEQWZV3hwZW1GMGFXOXVKblE5TVRVM01ERTVOak5sWWpsak9ESTBZV0ppTnprd09EazRPR1kzWkRVMU1qWW1kajB4In0.FSFDSFSDF.h4NhQHjuY3OoElIYXS3sPJWBI9eHdLCJYtmMF4yG9d8JBTmgCTwHXpjL0Ffj98C4a9AScMIeKmtcLynZKuAb-c8tjP9kqa_Z41Pn9SPUxBjajIzI39YTlq5XHv8qUNntSjr1-o_CYwOMnde3"
}
}

Step 6.

Open your cloud shell or terminal and run the next command. You do not need Uniskai for that.

curl -H "Authorization: Bearer {TOKEN FROM THE STEP 5}" "https://profisealabs.com/api/kubernetes/agent.yaml?component=vpa&component=metrics-server&mode=editor" | kubectl apply -f -

Step 7.

Refresh your account using the post request.

POST

https://profisealabs.com/api/environments/{ENV_ID}/refresh - Will refresh your account in the Uniskai.

Please wait until the refresh is complete.

Did this answer your question?