> ## Documentation Index
> Fetch the complete documentation index at: https://docs.keephq.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# EKS Provider

> EKS provider integrates with AWS EKS and let you interatct with kubernetes clusters hosted on EKS.

## Authentication

This provider requires authentication.

* **region**: AWS region where the EKS cluster is located (required: True, sensitive: False)
* **cluster\_name**: Name of the EKS cluster (required: True, sensitive: False)
* **access\_key**: AWS access key (Leave empty if using IAM role at EC2) (required: False, sensitive: True)
* **secret\_access\_key**: AWS secret access key (Leave empty if using IAM role at EC2) (required: False, sensitive: True)

Certain scopes may be required to perform specific actions or queries via the provider. Below is a summary of relevant scopes and their use cases:

* **eks:DescribeCluster**: Required to get cluster information (mandatory) ([Documentation](https://docs.aws.amazon.com/eks/latest/APIReference/API_DescribeCluster.html))
* **eks:ListClusters**: Required to list available clusters (mandatory) ([Documentation](https://docs.aws.amazon.com/eks/latest/APIReference/API_ListClusters.html))
* **pods:delete**: Required to delete/restart pods  ([Documentation](https://kubernetes.io/docs/reference/access-authn-authz/rbac/))
* **deployments:scale**: Required to scale deployments  ([Documentation](https://kubernetes.io/docs/reference/access-authn-authz/rbac/))
* **pods:list**: Required to list pods  ([Documentation](https://kubernetes.io/docs/reference/access-authn-authz/rbac/))
* **pods:get**: Required to get pod details  ([Documentation](https://kubernetes.io/docs/reference/access-authn-authz/rbac/))
* **pods:logs**: Required to get pod logs  ([Documentation](https://kubernetes.io/docs/reference/access-authn-authz/rbac/))

## In workflows

This provider can be used in workflows.

As "step" to query data, example:

```yaml theme={null}
steps:
    - name: Query eks
      provider: eks
      config: "{{ provider.my_provider_name }}"
      with:
        command_type: {value}  # Type of query to execute
        # Additional arguments for the query
```

Check the following workflow examples:

* [eks\_advanced.yml](https://github.com/keephq/keep/blob/main/examples/workflows/eks_advanced.yml)
* [eks\_basic.yml](https://github.com/keephq/keep/blob/main/examples/workflows/eks_basic.yml)

## Provider Methods

The provider exposes the following [Provider Methods](/providers/provider-methods#via-ai-assistant). They are available in the [AI Assistant](/overview/ai-incident-assistant).

* **get\_pods** List all pods in a namespace or across all namespaces (view, scopes: pods:list, pods:get)

  * `namespace`: The namespace to list pods from. If None, lists pods from all namespaces.

* **get\_pvc** List all PVCs in a namespace or across all namespaces (view, scopes: pods:list)

  * `namespace`: The namespace to list pods from. If None, lists pods from all namespaces.

* **get\_node\_pressure** Get pressure metrics for all nodes (view, scopes: pods:list)

* **exec\_command** Execute a command in a pod (action, scopes: pods:exec)

  * `namespace`: Namespace of the pod
  * `pod_name`: Name of the pod
  * `command`: Command to execute (string or array)
  * `container`: Name of the container (optional, defaults to first container)

* **restart\_pod** Restart a pod by deleting it (action, scopes: pods:delete)

  * `namespace`: Namespace of the pod
  * `pod_name`: Name of the pod

* **get\_deployment** Get deployment information (view, scopes: pods:list)

  * `deployment_name`: Name of the deployment to get
  * `namespace`: Target namespace (defaults to “default”)

* **scale\_deployment** Scale a deployment to specified replicas (action, scopes: deployments:scale)

  * `deployment_name`: Name of the deployment to get
  * `namespace`: Target namespace (defaults to “default”)
  * `replicas`: Number of replicas to scale to

* **get\_pod\_logs** Get logs from a pod (view, scopes: pods:logs)

  * `namespace`: Namespace of the pod
  * `pod_name`: Name of the pod
  * `container`: Name of the container (optional)
  * `tail_lines`: Number of lines to fetch from the end of logs (default: 100)

## Connecting with the Provider

To connect to Amazon EKS, follow these steps:

1. Log in to your [AWS Console](https://aws.amazon.com/)

2. Create an IAM user with EKS permissions:

```bash theme={null}
aws iam create-user --user-name eks-user
```

3. Attach required policies:

```bash theme={null}
aws iam attach-user-policy --user-name eks-user --policy-arn arn:aws:iam::aws:policy/AmazonEKSClusterPolicy
aws iam attach-user-policy --user-name eks-user --policy-arn arn:aws:iam::aws:policy/AmazonEKSServicePolicy
```

4. Create access keys

```bash theme={null}
aws iam create-access-key --user-name eks-user
```

You should get:

```
{
  "AccessKey": {
    "AccessKeyId": "AKIAXXXXXXXXXXXXXXXX",
    "SecretAccessKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "Status": "Active"
  }
}
```

The `AccessKeyId` is your `access_key` and `SecretAccessKey` is your `secret_access_key`.

5. Note your cluster name and region from the EKS console or using:

```bash theme={null}
aws eks list-clusters --region <your-region>
```

## Required Permissions

The AWS IAM user needs these permissions:

1. **eks:DescribeCluster**
2. **eks:ListClusters**

Additional permissions for specific operations:

3. **eks:AccessKubernetesApi** for pod/deployment operations
4. **eks:UpdateCluster** for scaling operations

| Command             | AWS IAM Permissions                                    |
| ------------------- | ------------------------------------------------------ |
| `get_pods`          | `eks:DescribeCluster` <br /> `eks:AccessKubernetesApi` |
| `get_pvc`           | `eks:DescribeCluster` <br /> `eks:AccessKubernetesApi` |
| `get_node_pressure` | `eks:DescribeCluster` <br /> `eks:AccessKubernetesApi` |
| `get_deployment`    | `eks:DescribeCluster` <br /> `eks:AccessKubernetesApi` |
| `scale_deployment`  | `eks:DescribeCluster` <br /> `eks:AccessKubernetesApi` |
| `exec_command`      | `eks:DescribeCluster` <br /> `eks:AccessKubernetesApi` |
| `restart_pod`       | `eks:DescribeCluster` <br /> `eks:AccessKubernetesApi` |
| `get_pod_logs`      | `eks:DescribeCluster` <br /> `eks:AccessKubernetesApi` |
