# Use Helm to deploy Aerospike Backup Service on Kubernetes

::: caution
AKO version 4.x or later does not support Aerospike Backup Service version 2.x. Upgrade to Aerospike Backup Service v3.0.0 or later. See [Upgrade ABS](https://aerospike.com/docs/kubernetes/tools/backup/upgrade-backup-service) for more information.

Breaking changes when upgrading from an Aerospike Backup Service Helm chart version earlier than 4.0.0:

-   It no longer creates the service account `aerospike-backup-service`. Create the service account before deploying/upgrading the ABS by following [this](#install-and-deploy) step.
:::

## Requirements

Before deploying your Aerospike Backup Service (ABS) using Helm, install AKO on your Kubernetes cluster using either:

-   [OLM](https://aerospike.com/docs/kubernetes/4.1.x/install/olm)
-   [Helm](https://aerospike.com/docs/kubernetes/4.1.x/install/helm)

## Install and deploy

We recommend using one ABS deployment per Aerospike cluster.

1.  Create service account
    
    AKO in the namespace where ABS is deployed.
    
    ```plaintext
    kubectl create serviceaccount aerospike-backup-service -n aerospike
    ```
    
    ::: note
    You can use a different service account name. Refer to the [ABS CR file](https://aerospike.com/docs/kubernetes/4.1.x/tools/backup/backup-service-configuration) to set the service account name.
    :::
    
2.  Configure S3 backup storage (optional)
    
    ABS supports S3 compatible storage as well as local storage for backups. If you use S3 compatible storage, add the credentials or roles to the ABS `values.yaml` file so ABS can connect to the remote storage.
    
    -   [S3 Static Credentials (Kubernetes Secrets)](#tab-panel-1208)
    -   [IAM Roles for Service Accounts (IRSA)](#tab-panel-1209)
    
    Create a Kubernetes secret with the S3 credentials.
    
    ```plaintext
    kubectl -n aerospike create secret generic aws-secret --from-file=PATH_TO_AWS_CREDENTIALS
    ```
    
    See the [AWS documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) for the format of the credentials file.
    
    Mount the `aws-secret` secret in the ABS pod by adding the `secrets` field in the ABS Helm chart values.yaml.
    
    ```yaml
    secrets:
    
      - secretName: aws-secret
    
        volumeMount:
    
          name: aws-secret
    
          mountPath: /home/absuser/.aws/credentials
    
          subPath: credentials
    ```
    
    Create and attach an IAM role with the required permissions to the ABS service account `aerospike-backup-service`. Change the serviceaccount and role ARN in the following example to the ARN of the IAM role you created.
    
    ```yaml
    kubectl annotate serviceaccount -n aerospike aerospike-backup-service eks.amazonaws.com/role-arn=arn:aws:iam::123456789012:role/MyServiceRole
    ```
    
    See the IRSA documentation for more information on [IAM roles for service accounts](https://docs.aws.amazon.com/eks/latest/userguide/associate-service-account-role.html).
    
3.  Add the Helm repository to get the Helm charts.
    
    ```plaintext
    helm repo add aerospike https://aerospike.github.io/aerospike-kubernetes-enterprise
    ```
    
    If the Helm repository is already added, update the index:
    
    ```plaintext
    helm repo update
    ```
    
4.  Prepare `values.yaml` for ABS.
    
    Create a custom `values.yaml` file with your required configurations. The following is an example custom `values.yaml` file.
    
    ```yaml
    image:
    
      repository: aerospike/aerospike-backup-service
    
      tag: "3.0.0"
    
    backupServiceConfig:
    
      service:
    
        http:
    
          port: 8080
    
      backup-policies:
    
        test-policy:
    
          parallel: 3
    
      storage:
    
        local:
    
          local-storage:
    
            path: /tmp/localStorage
    
    #    s3Storage: # Uncomment below lines to use S3 storage
    
    #      s3-storage:
    
    #        bucket: aerospike-kubernetes-operator-test
    
    #        s3-region: us-east-1
    
    #        s3-profile: default
    
    #secrets:
    
    #  - secretName: aws-secret
    
    #    volumeMount:
    
    #      name: aws-secret
    
    #      mountPath: /home/absuser/.aws/credentials
    
    #      subPath: credentials
    
    service:
    
      type: ClusterIP
    ```
    
5.  Deploy ABS.
    
    Install the Helm chart with custom values.
    
    ```plaintext
    helm install aerospikebackupservice-sample aerospike/aerospike-backup-service -f PATH_TO_CUSTOM_YAML_FILE
    ```
    
6.  Verify ABS status.
    
    Run `kubectl get deployment` to check that AKO has created the ABS deployment.
    
    ```plaintext
    $ kubectl get deployment -n aerospike
    
    NAME                            READY   UP-TO-DATE   AVAILABLE   AGE
    
    aerospikebackupservicesample   1/1     1            1           9s
    ```
    
    Run `kubectl get pods` to check the pods to confirm the status. This step may take time as the pods provision resources, initialize, and become ready. Wait for the pods to switch to the **Running** state before you continue.
    
    ```plaintext
    $ kubectl get pods -n aerospike
    
    NAME                                             READY   STATUS    RESTARTS   AGE
    
    aerospikebackupservicesample-7b7f7b5648-kpfxh   1/1     Running   0          43s
    ```
    

## Configurations

For more details on these configurations, see the Aerospike [Backup Service Configuration Settings](https://aerospike.com/docs/kubernetes/4.1.x/tools/backup/backup-service-configuration).

| Name | Description | Default |
| --- | --- | --- |
| `image.repository` | Aerospike backup service container image repository | `aerospike/aerospike-backup-service` |
| `image.tag` | Aerospike backup service container image tag | `3.2.0` |
| `customLabels` | Custom labels to add on the Aerospike backup service resource | `{}` (nil) |
| `backupServiceConfig` | Aerospike backup service configuration | `{}` (nil) |
| `secrets` | Secrets to be mounted in the Aerospike backup service pod such as AWS credentials | `[]` (nil) |
| `resources` | Aerospike backup service pod resource requirements | `{}` (nil) |
| `service` | Kubernetes service configuration for Aerospike backup service | `{}` (nil) |
| `podSpec` | Aerospike backup service pod configuration | `{}` (nil) |