This guide explains step by step how to upgrade Apinizer images running on Kubernetes. 


The example scenario was realized on servers with Ubuntu 22.04 operating system.

1) MongoDB Backup

First, a backup operation is performed on MongoDB. The backup is always done as the first step of the update process to avoid data loss. This command is executed on the mongoDb primary server.

# Taking Backup
sudo mongodump --host <IP_ADDRESS> --port=25080 --username=apinizer --password=<PASSWORD> --authenticationDatabase=admin --gzip --archive=<BACKUP_DIRECTORY>/apinizer-backup<BACKUP_VERSION>.archive
BASH

2) Updating the Apinizer Manager App


Apinizer Manager must be updated before updating Apinizer Worker and Cache. The reason for this is that Worker and Cache receive database related updates after Manager's settings to the database. If Worker and Cache are updated before Manager, this can cause problems on Worker and Cache side. Therefore, after updating Manager, make sure that the Manager pods on Kubernetes are in the “ready” state and then update the other components.

This and subsequent steps are run on servers with the Kubernetes Control Plane task.

# Information about the Deployment is checked
kubectl get deployments -Ao wide  

# Manager's deployment image is updated
kubectl set image deployment/<MANAGER_DEPLOYMENT_NAME> -n <NAMESPACE> <MANAGER_CONTAINER_NAME>=apinizercloud/manager:<NEW_VERSION>

# Wait for the pod to be READY, monitor pod status
kubectl get pods -A -w
BASH

3) Updating Apinizer Worker and Cache Applications

After making sure that the image of the Apinizer Manager application is updated, the Apinizer Worker and Cache applications are updated.

kubectl set image deployment/<WORKER_DEPLOYMENT_NAME> -n <NAMESPACE> <WORKER_CONTAINER_NAME>=apinizercloud/worker:<NEW_VERSION>
kubectl set image deployment/<CACHE_DEPLOYMENT_NAME> -n <NAMESPACE>  <CACHE_CONTAINER_NAME>=apinizercloud/worker:<NEW_VERSION>

# Pods are expected to be READY, pod status is monitored
kubectl get pods -n <DEPLOYMENT_NAMESPACE> -w
BASH

4) Updating Apinizer Portal and Integration Applications

Apinizer Portal and Integration can be updated in a similar way.

kubectl set image deployment/<PORTAL_DEPLOYMENT_NAME> -n <NAMESPACE> <PORTAL_CONTAINER_NAME>=apinizercloud/portal:<NEW_VERSION>
kubectl set image deployment/<INTEGRATION_DEPLOYMENT_NAME> -n <NAMESPACE> <INTEGRATION_CONTAINER_NAME>=apinizercloud/integration:<NEW_VERSION>

# Pods are expected to be READY, pod status is monitored
kubectl get pods -n <DEPLOYMENT_NAMESPACE> -w
BASH