# Online Installation

Before starting the installation, make sure the [requirements](https://docs.akamas.io/akamas-docs/3.2.1-1/installing-akamas/kubernetes/prerequisites) are met.

## Create the configuration file

Akamas on Kubernetes is provided as a set of templates packaged in a chart archive managed by [Helm](https://helm.sh/).

To proceed with the installation, you need to create a file, called `akamas.yaml` in this guide, containing the mandatory configuration values required to customize your application. The following template contains the minimal set of values required to install Akamas:

```yaml
# AWS credentials to fetch ECR images (required)
awsAccessKeyId: <AWS_ACCESS_KEY_ID>
awsSecretAccessKey: <AWS_SECRET_ACCESS_KEY>

# Akamas customer name. Must match the value in the license (required)
akamasCustomer: <CUSTOMER_NAME>

# Akamas administrator password. If not set a random password will be generated
akamasAdminPassword: <ADMIN_PASSWORD>
```

You can also download the template file running the following snippet:

```bash
curl -so akamas.yaml  http://helm.akamas.io/templates/1.0.2/akamas.yaml.template
```

This minimal configuration is enough to have Akamas up and running on your cluster, even though the endpoint will only be accessible through Kubectl's [port forwarding](https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/).

The page [Accessing Akamas](https://docs.akamas.io/akamas-docs/3.2.1-1/installing-akamas/kubernetes/accessing-akamas) provides some configuration examples using different types of services: edit the `akamas.yaml` file using the strategy that best suits your needs, or continue directly with the next sections and configure the endpoints at a later time.

## Start the installation

Add the Akamas' repository to the Helm client with the following command:

```bash
helm repo add akamas http://helm.akamas.io/charts
```

If you wish to see the values that Helm will use to install Akamas and override some of them, you may execute the following command:

```bash
helm show values akamas/akamas
```

Now, with the configuration file you just created (and the new variables you added to override the defaults), you can start the installation with the following command:

```bash
helm upgrade --install \
  --create-namespace --namespace akamas \
  -f akamas.yaml \
  akamas akamas/akamas
```

This command will create the Akamas resources within the specified namespace. You can define a different namespace by changing the argument `--namespace <your-namespace>`

An example output of a successful installation is the following:

```
Release "akamas" does not exist. Installing it now.
NAME: akamas
LAST DEPLOYED: Wed Apr  5 11:40:19 2023
NAMESPACE: akamas
STATUS: deployed
REVISION: 1
NOTES:
Akamas has been installed

NOTES:
Akamas has been installed

To get the initial password use the following command:

kubectl get secret akamas-admin-credentials -o go-template='{{ .data.password | base64decode }}'
```

## Check the installation

To monitor the application startup, run the command `kubectl get pods`. After a few minutes, the expected output should be similar to the following:

```
NAME                           READY   STATUS    RESTARTS   AGE
airflow-6ffbbf46d8-dqf8m       3/3     Running   0          5m
analyzer-67cf968b48-jhxvd      1/1     Running   0          5m
campaign-666c5db96-xvl2z       1/1     Running   0          5m
database-0                     1/1     Running   0          5m
elasticsearch-master-0         1/1     Running   0          5m
keycloak-66f748d54-7l6wb       1/1     Running   0          5m
kibana-6d86b8cbf5-6nz9v        1/1     Running   0          5m
kong-7d6fdd97cf-c2xc9          1/1     Running   0          5m
license-54ff5cc5d8-tr64l       1/1     Running   0          5m
log-5974b5c86b-4q7lj           1/1     Running   0          5m
logstash-8697dd69f8-9bkts      1/1     Running   0          5m
metrics-577fb6bf8d-j7cl2       1/1     Running   0          5m
optimizer-5b7576c6bb-96w8n     1/1     Running   0          5m
orchestrator-95c57fd45-lh4m6   1/1     Running   0          5m
store-5489dd65f4-lsk62         1/1     Running   0          5m
system-5877d4c89b-h8s6v        1/1     Running   0          5m
telemetry-8cf448bf4-x68tr      1/1     Running   0          5m
ui-7f7f4c4f44-55lv5            1/1     Running   0          5m
users-966f8f78-wv4zj           1/1     Running   0          5m
```

At this point, you should be able to access the Akamas UI on `http://localhost:8000` and the Akamas CLI `http://localhost:8000/akapi` by running Kubectl's port forwarding command:

```bash
kubectl port-forward service/ui 8000:http
```

Mind that, before logging in, you need to [configure the Akamas CLI](https://docs.akamas.io/akamas-docs/3.2.1-1/installing-akamas/install-the-akamas-cli/initialize-akamas-cli) and [install a valid license](https://docs.akamas.io/akamas-docs/3.2.1-1/installing-akamas/install-the-akamas-license).

If you haven't already, you can update your configuration file to use a different type of service to expose Akamas' endpoints. To do so, pick from the [Accessing Akamas](https://docs.akamas.io/akamas-docs/3.2.1-1/installing-akamas/kubernetes/accessing-akamas) the configuration snippet for the service type of your choice, add it to the `akamas.yaml` file, and re-run the installation command to update your Helm release.
