Upgrade OpenResty Edge in Kubernetes

Before upgrading in a production environment, we strongly recommend that you build a test environment identical to the production environment using production data and test the upgrade in that environment. Upgrading should only be performed in the production environment after successful completion of testing. For detailed steps on cloning the environment, please refer to the Clone OpenResty Edge Environment documentation.

1. Download Deployment Files

First, please visit the OpenResty official Download Center to download the latest version of the deployment file openresty-edge-VERSION.yml.

2. Configure Upgrade Strategy

  • On a machine with the kubectl command installed and with access to the Kubernetes cluster, create a file named patch-on-delete.yaml:
spec:
  updateStrategy:
    $retainKeys:
    - type
    type: OnDelete
  • Apply the upgrade strategy:
kubectl patch statefulset oredge-log-server-database -n openresty-edge --patch "$(cat patch-on-delete.yaml)"
kubectl patch statefulset oredge-admin-database -n openresty-edge --patch "$(cat patch-on-delete.yaml)"
kubectl patch statefulset oredge-admin -n openresty-edge --patch "$(cat patch-on-delete.yaml)"
kubectl patch statefulset oredge-node -n openresty-edge --patch "$(cat patch-on-delete.yaml)"

3. Upgrade Edge Log Server

Execute the following command to upgrade Edge Log Server:

kubectl apply --server-side=true -f openresty-edge-VERSION.yml

You can monitor the progress during the upgrade process by running the kubectl get pods -n openresty-edge command.

4. Upgrade Edge Log Server Database

Run the following command to upgrade the Edge Log Server database:

kubectl delete pod oredge-log-server-database-0 -n openresty-edge

5. Upgrade Edge Node

Before upgrading each oredge-node related POD, please ensure that the configuration has been fully synchronized with the new Edge Node. Services on the Edge Node currently being upgraded will be disrupted, so to prevent overall service interruption, please ensure that there are available Edge Nodes.

kubectl delete pod oredge-node-SERIAL_NUMBER -n openresty-edge

Replace SERIAL_NUMBER with the actual POD serial number, such as oredge-node-0.

6. Upgrade Edge Admin Database

Execute the following command to upgrade the Edge Admin database:

kubectl delete pod oredge-admin-database-0 -n openresty-edge

7. Upgrade Edge Admin

Run the following command to upgrade Edge Admin:

kubectl delete pod oredge-admin-0 -n openresty-edge

8. Recompile Configuration

Log into the Edge Admin Pod oredge-admin-0:

kubectl exec -it oredge-admin-0 -n openresty-edge -- /bin/bash

Then execute the following commands to recompile the configuration:

cd /usr/local/oredge-admin
sudo bash utils/recompile-apps.sh wildcard-http
sudo bash utils/recompile-apps.sh http
sudo bash utils/recompile-apps.sh http_proxy
sudo bash utils/recompile-apps.sh socks5_proxy
sudo bash utils/recompile-apps.sh global
sudo bash utils/recompile-apps.sh waf
sudo bash utils/recompile-apps.sh dns
sudo bash utils/recompile-apps.sh global-action
sudo bash utils/recompile-apps.sh gateway

If there are any issues, please get in touch with us for communication. :)