## Installation

This page contains detailed instructions for bootstrapping a AWS EKS Cluster (K8S) via [eksctl](https://github.com/weaveworks/eksctl).

### Configure EKS Cluster

Create the file rasa-x.yaml for eksctl

Please change the values region / availabilityZones / name (Clustername) accordingly if needed.

```bash
cat << EOF > rasa-x.yaml
---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
  name: rasa-x-eksctl
  region: eu-central-1
  version: "1.19"
availabilityZones: ["eu-central-1a", "eu-central-1b"]
managedNodeGroups:
  - name: nodegroup
    desiredCapacity: 3
    instanceType: t3.medium
EOF
```

### Create EKS Cluster

Create the EKS cluster via `eksctl`:

```bash
eksctl create cluster -f rasa-x.yaml
```

This takes 15-20 around minutes. When it completes, the new cluster will be added to your `~/.kube/config` file and set as the current context for kubectl.

```bash
2021-09-09 13:57:27 [ℹ] using region eu-central-1
2021-09-09 13:57:27 [ℹ] subnets for eu-central-1a - public:192.168.0.0/19 private:192.168.64.0/19
2021-09-09 13:57:27 [ℹ] subnets for eu-central-1b - public:192.168.32.0/19 private:192.168.96.0/19
2021-09-09 13:57:27 [ℹ] nodegroup "nodegroup" will use "" [AmazonLinux2/1.19]
...
2021-09-09 14:21:02 [✔] EKS cluster "rasa-x-eksctl" in "eu-central-1" region is ready
```

### Deploy NGINX ingress with NetworkLoadBalancer

To make RASA X available over the internet we will deploy NGINX Ingress with a NetworkLoadBalancer.

The following command will deploy NGINX Ingress and create the NetworkLoadBalancer.

```bash
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-0.32.0/deploy/static/provider/aws/deploy.yaml
```

Check with `kubectl` afterwards that everything is deployed and running:

```bash
$ kubectl -n ingress-nginx get pods
```

Check that the NetworkLoadBalancer got allocated and assigned:

```bash
$ kubectl -n ingress-nginx get service
NAME                               TYPE           CLUSTER-IP     EXTERNAL-IP                                                                 PORT(S)                    AGE
ingress-nginx-controller           LoadBalancer   10.100.187.239 af6e0b3f4129d483db5dd01b60e76056-ec0064f8a93a6fed.elb.eu-central-1.amazonaws.com  80:30622/TCP,443:30015/TCP 57m
```

Please follow the instructions to [install Rasa X using the Rasa X Helm chart](https://legacy-docs-enterprise.rasa.com/docs/rasa-enterprise/1.0.x/installation-and-setup/install/helm-chart-installation/installation) next.

Once you have installed Rasa X via the Helm chart, you will see the NetworkLoadBalancer linked with the referring Ingress exposed.

```bash
kubectl get ing -A
```

Finally, create a CNAME Record with your designated FQDN to the NetworkLoadBalancer CNAME record.

## Next Steps

- [Setup Rasa X via Helmchart](https://legacy-docs-enterprise.rasa.com/docs/rasa-enterprise/1.0.x/installation-and-setup/install/helm-chart-installation/installation) on the fresh created AWS EKS Cluster.
