# Upgrade AKO from OperatorHub.io

This is the procedure to upgrade AKO, [installed from OperatorHub.io](https://aerospike.com/docs/kubernetes/4.1.x/install/olm), to version 4.1.2.

::: note
If you are running an AKO version older than 4.0.2, you must first upgrade to 4.0.2 before upgrading to 4.1.2:

-   [Upgrade to 4.0.2](https://aerospike.com/docs/kubernetes/4.0.x/manage/upgrade/upgrading-operator)
:::

## Verify that AKO 4.1.2 is available

Use the following command to verify 4.1.2 as the current CSV version:

```plaintext
kubectl get packagemanifests  -l catalog=operatorhubio-catalog,provider=Aerospike -o yaml | grep currentCSV:
```

The following should appear:

Terminal window

```bash
- currentCSV: aerospike-kubernetes-operator.v2.5.0

  - currentCSV: aerospike-kubernetes-operator.v4.1.2
```

## Upgrade AKO

Based on the [installPlanApproval](https://olm.operatorframework.io/docs/concepts/crds/subscription/#manually-approving-upgrades-via-subscriptions) mode, the upgrade of AKO can be one of

-   [Automatic](#automatic) - the default when installing AKO from OperatorHub.io.
-   [Manual](#manual) - if the OperatorHub.io subscription has been edited to use manual approval.

### Automatic

The standard install procedure sets up automatic upgrade approval for AKO. In this case OLM automatically installs AKO version 4.1.2. No manual steps are necessary.

You can skip ahead to [verification](#verify-that-the-operator-is-upgraded).

### Manual

If the OperatorHub.io subscription has been edited to use manual approval, you need to approve the upgrade as follows:

Verify that the InstallPlan for version 4.1.2 has been created.

```plaintext
kubectl get installplan -n operators | grep aerospike
```

Sample output with an InstallPlan for version 4.1.2.

Terminal window

```bash
NAME            CSV                                    APPROVAL   APPROVED

install-2tg7p   aerospike-kubernetes-operator.v4.1.2   Manual     false
```

In this example, the upgrade is not applied since the `APPROVED` status is `false`.

To approve the upgrade, set the `approved` field in the InstallPlan to `true`:

Terminal window

```bash
kubectl patch installplan -n operators --type merge --patch '{'{'}"spec":{'{'}"approved":true{'}'}{'}'}'  $(kubectl get installplan -n operators | grep "aerospike-kubernetes-operator.v4.1.2" | cut -f 1 -d " ")
```

## Verify that the Operator is upgraded

Run the following command:

```plaintext
kubectl get csv -n operators | grep aerospike
```

The upgrade can take some time. The CSV for version 4.1.2 goes through the phases `Pending`, `Installing`, `InstallReady` and finally `Succeeded`.

The sample output below illustrates a successful upgrade:

Terminal window

```bash
NAME                                   DISPLAY                         VERSION   REPLACES                               PHASE

aerospike-kubernetes-operator.v4.1.2   Aerospike Kubernetes Operator   4.1.2     aerospike-kubernetes-operator.v4.0.2   Succeeded
```

## Check operator logs

AKO runs as two replicas by default for higher availability. Run the following command to follow the logs for the AKO pods.

```plaintext
kubectl -n operators logs -f deployments/aerospike-operator-controller-manager manager
```

Sample output:

Terminal window

```shell
2025-08-06T08:42:37Z    INFO    setup   Initializing webhook certificate watcher using provided certificates    {"webhook-cert-path": "/tmp/k8s-webhook-server/serving-certs", "webhook-cert-name": "tls.crt", "webhook-cert-key": "tls.key"}

2025-08-06T08:42:37Z    INFO    controller-runtime.certwatcher  Updated current TLS certificate

2025-08-06T08:42:37Z    INFO    setup   Init aerospike-server config schemas

2025-08-06T08:42:37Z    DEBUG   setup   Config schema added     {"version": "6.0.0"}

2025-08-06T08:42:37Z    DEBUG   setup   Config schema added     {"version": "6.3.0"}

2025-08-06T08:42:37Z    DEBUG   setup   Config schema added     {"version": "7.1.0"}

2025-08-06T08:42:37Z    DEBUG   setup   Config schema added     {"version": "8.0.0"}

2025-08-06T08:42:37Z    DEBUG   setup   Config schema added     {"version": "8.1.0"}

2025-08-06T08:42:37Z    DEBUG   setup   Config schema added     {"version": "6.1.0"}

2025-08-06T08:42:37Z    DEBUG   setup   Config schema added     {"version": "6.2.0"}

2025-08-06T08:42:37Z    DEBUG   setup   Config schema added     {"version": "6.4.0"}

2025-08-06T08:42:37Z    DEBUG   setup   Config schema added     {"version": "7.0.0"}

2025-08-06T08:42:37Z    DEBUG   setup   Config schema added     {"version": "7.2.0"}

2025-08-06T08:42:37Z    INFO    controller-runtime.builder      Registering a mutating webhook  {"GVK": "asdb.aerospike.com/v1, Kind=AerospikeCluster", "path": "/mutate-asdb-aerospike-com-v1-aerospikecluster"}

2025-08-06T08:42:37Z    INFO    controller-runtime.webhook      Registering webhook     {"path": "/mutate-asdb-aerospike-com-v1-aerospikecluster"}

2025-08-06T08:42:37Z    INFO    controller-runtime.builder      Registering a validating webhook        {"GVK": "asdb.aerospike.com/v1, Kind=AerospikeCluster", "path": "/validate-asdb-aerospike-com-v1-aerospikecluster"}

2025-08-06T08:42:37Z    INFO    controller-runtime.webhook      Registering webhook     {"path": "/validate-asdb-aerospike-com-v1-aerospikecluster"}

2025-08-06T08:42:37Z    INFO    controller-runtime.builder      Registering a mutating webhook  {"GVK": "asdb.aerospike.com/v1beta1, Kind=AerospikeBackupService", "path": "/mutate-asdb-aerospike-com-v1beta1-aerospikebackupservice"}

2025-08-06T08:42:37Z    INFO    controller-runtime.webhook      Registering webhook     {"path": "/mutate-asdb-aerospike-com-v1beta1-aerospikebackupservice"}

2025-08-06T08:42:37Z    INFO    controller-runtime.builder      Registering a validating webhook        {"GVK": "asdb.aerospike.com/v1beta1, Kind=AerospikeBackupService", "path": "/validate-asdb-aerospike-com-v1beta1-aerospikebackupservice"}

2025-08-06T08:42:37Z    INFO    controller-runtime.webhook      Registering webhook     {"path": "/validate-asdb-aerospike-com-v1beta1-aerospikebackupservice"}

2025-08-06T08:42:37Z    INFO    controller-runtime.builder      Registering a mutating webhook  {"GVK": "asdb.aerospike.com/v1beta1, Kind=AerospikeBackup", "path": "/mutate-asdb-aerospike-com-v1beta1-aerospikebackup"}

2025-08-06T08:42:37Z    INFO    controller-runtime.webhook      Registering webhook     {"path": "/mutate-asdb-aerospike-com-v1beta1-aerospikebackup"}

2025-08-06T08:42:37Z    INFO    controller-runtime.builder      Registering a validating webhook        {"GVK": "asdb.aerospike.com/v1beta1, Kind=AerospikeBackup", "path": "/validate-asdb-aerospike-com-v1beta1-aerospikebackup"}

2025-08-06T08:42:37Z    INFO    controller-runtime.webhook      Registering webhook     {"path": "/validate-asdb-aerospike-com-v1beta1-aerospikebackup"}

2025-08-06T08:42:37Z    INFO    controller-runtime.builder      Registering a mutating webhook  {"GVK": "asdb.aerospike.com/v1beta1, Kind=AerospikeRestore", "path": "/mutate-asdb-aerospike-com-v1beta1-aerospikerestore"}

2025-08-06T08:42:37Z    INFO    controller-runtime.webhook      Registering webhook     {"path": "/mutate-asdb-aerospike-com-v1beta1-aerospikerestore"}

2025-08-06T08:42:37Z    INFO    controller-runtime.builder      Registering a validating webhook        {"GVK": "asdb.aerospike.com/v1beta1, Kind=AerospikeRestore", "path": "/validate-asdb-aerospike-com-v1beta1-aerospikerestore"}

2025-08-06T08:42:37Z    INFO    controller-runtime.webhook      Registering webhook     {"path": "/validate-asdb-aerospike-com-v1beta1-aerospikerestore"}

2025-08-06T08:42:37Z    INFO    setup   Adding webhook certificate watcher to manager

2025-08-06T08:42:37Z    INFO    setup   Starting manager

2025-08-06T08:42:37Z    INFO    controller-runtime.metrics      Starting metrics server

2025-08-06T08:42:37Z    INFO    starting server {"name": "health probe", "addr": "[::]:8081"}

2025-08-06T08:42:37Z    INFO    setup   disabling http/2

2025-08-06T08:42:37Z    INFO    controller-runtime.webhook      Starting webhook server

2025-08-06T08:42:37Z    INFO    setup   disabling http/2

2025-08-06T08:42:37Z    INFO    controller-runtime.webhook      Serving webhook server  {"host": "", "port": 9443}
```