Upgrade/Deployment Strategy on K8S

For upgrading MetaDefender Core the container of the application contains the automation to upgrade the database schema and migrate the configuration data. There are 3 strategies that we would like to point out to use when upgrading it.

  1. Rolling Update ( Easy deployment where functionality test with new version is based on Kubernetes Probes )
  2. Blue-Green Deployment (2 or more activations licensed where is possible to test the new image before) - On RoadMap
  3. Blue-Green Deployment + Hot Backup ( When needed to go above the activations licensed ) - On RoadMap

Upgrading from one version to another on Kubernetes only support the migration of specific data.

  • Workflow
  • Healthcheck
  • User Management

The data of the processing history is not supported to be migrated from one version to another

As indicated in Deploying on K8S , the Kubernetes probes like Readiness and Liveness probes help the application to control the expected behavior, not to have a downtime, when doing an upgrade.

RollingUpdate Strategy

When using the Rolling Update strategy provided by Kubernets technology, these are the main points to consider

  • Traffic wont be sent to new pods until readiness probe is succesful
  • Old version pods won’t be terminated until new version pods are ready to serve traffic
  • Rolling Update is the default strategy for deployment

How to upgrade using RollingUpdate

When using the RollingUpdate strategy, there are two more options that let you fine-tune the update process:

  • maxSurge: The number of pods that can be created above the desired amount of pods during an update
  • maxUnavailable: The number of pods that can be unavailable during the update process

Both maxSurge and maxUnavailable can be specified as either an integer (e.g. 2) or a percentage (e.g. 50%), and they cannot both be zero

If requests are being sent they can end up hitting two different version pods meaning two different databases.

Step by step using kubectl

  • Set Up the environment variables for the pod to know that will need to migrate the information to new database
Bash
Copy
  • Set new image version on the MetaDefender Core deployment
Bash
Copy

Step by step using helm

  • Set new image version in values.yaml helm file
values.yaml
Copy
  • Run helm upgrade command with the environment variables desired if not indicated in values.yaml file when first deployment
Bash
Copy

Rollout Failed Update

Bash
Copy

How to upgrade with API Export/Import Configuration (Old-Fashioned way)

The steps needed to follow are:

1. Export the current configuration, like user management, worflows or settings configured. For it is needed to use the API endpoint Export Configuration (New version)

Bash
Copy

2. Adapt helm configuration to upgrade to the new image version

  • In case of controlling all the data from your values.yaml file, be sure that the maxUnavailable and maxSurge attributes of the deployment strategy is adapted to your deployment use case and the image version is changed to the new one
YAML
Copy
Bash
Copy
  • In case of controlling attributes from the helm install command, be sure that the maxUnavailable and maxSurge attributes of the deployment strategy is adapted to your deployment use case and the image version is changed to the new one
Bash
Copy

3. Import the configuration exported in the step 1 For it is needed to use the API endpoint Import Configuration (New version) . See how to use it in the example below.

Bash
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard