# Set Up Kubernetes Cluster on AWS EKS

This page provides step-by-step instructions to provision a Kubernetes cluster on Amazon Elastic Kubernetes Service (EKS) for deploying Nected.

{% hint style="success" %}
Read the official [AWS EKS Setup Guide](https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html), to read the steps in more detail.
{% endhint %}

### Prerequisites

Before setting up your Kubernetes cluster, ensure you've installed:

* **eksctl**: See the [official eksctl documentation](https://eksctl.io/introduction/#installation) for installation steps.
* **awscli**: See the [official AWS CLI documentation](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) for installation steps.

Verify your AWS CLI configuration and connectivity by running:

```bash
aws sts get-caller-identity
```

This command confirms your AWS account details and ensures your CLI configuration is correctly set.

***

### Create and Configure the EKS Cluster

Follow these steps to create a Kubernetes cluster on AWS EKS for your Nected deployment:

#### Step 1: Create an EKS Cluster

Run the following command using `eksctl` to provision your cluster:

```bash
eksctl create cluster --name <CLUSTER_NAME> --region <REGION_NAME> --node-type t2.2xlarge
```

Replace placeholders as follows:

| Placeholder      | Description                               | Example       |
| ---------------- | ----------------------------------------- | ------------- |
| `<CLUSTER_NAME>` | Name for your Kubernetes cluster          | `nected-prod` |
| `<REGION_NAME>`  | AWS Region where your cluster will reside | `us-west-2`   |

#### Step 2: Generate KubeConfig File

To connect to your newly created cluster, generate the KubeConfig file by running:

```bash
aws eks update-kubeconfig --region <REGION_NAME> --name <CLUSTER_NAME> --profile <PROFILE_NAME>
```

Replace placeholders as follows:

| Placeholder      | Description                                   | Example       |
| ---------------- | --------------------------------------------- | ------------- |
| `<REGION_NAME>`  | AWS Region of your EKS cluster                | `us-west-2`   |
| `<CLUSTER_NAME>` | Name of your EKS cluster                      | `nected-prod` |
| `<PROFILE_NAME>` | AWS CLI profile configured with access to EKS | `default`     |

#### Step 3: Verify Cluster Configuration

Confirm your Kubernetes cluster connection:

```bash
kubectl cluster-info
```

This command displays essential details of your Kubernetes cluster, confirming successful setup.

***

### Define a Storage Class for Persistent Volumes

Nected requires persistent storage. Create a default storage class using Amazon EBS (`gp2`) with the following steps.

Execute the following command in your terminal:

```bash
kubectl apply -f - <<EOF
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: gp2
provisioner: kubernetes.io/aws-ebs
EOF
```

Set this storage class as the default for your Kubernetes cluster:

```bash
kubectl patch storageclass gp2 \\
-p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
```

#### Step 4: Attach IAM Policy for EBS Access

Ensure your cluster nodes have the required IAM policy (`AmazonEC2FullAccess`) to manage EBS volumes:

* Open your AWS IAM Console.
* Navigate to your cluster’s IAM roles (for both cluster and node group).
* Attach the `AmazonEC2FullAccess` policy to these roles.

This policy is essential for provisioning persistent storage dynamically.

***

### Next Steps

With your AWS EKS Kubernetes cluster configured, you are now ready to deploy Nected:

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Kubernetes</strong></td><td>Deploy Nected on Kubernetes for a production-grade setup with automatic scaling, load balancing, and high availability.</td><td><a href="https://4290782554-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLg716fCfV8IUwXQygkTG%2Fuploads%2F2FlQFYoKN65zMx063QxX%2FKubernetes.png?alt=media&#x26;token=96dfc49b-d9c4-48ff-99f4-55210fc2bbfa">Kubernetes.png</a></td><td><a href=""></a></td></tr></tbody></table>

{% hint style="info" %}
If you encounter any issues during cluster setup, please reach out to our support team at <assist@nected.ai>.
{% endhint %}
