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.

After the download is complete, please make adjustments to openresty-edge-VERSION.yml. For details, see Adjust Deployment File and Additional Information.

In addition to the adjustments mentioned above, if you are using a StorageClass that is not network storage but single-machine storage, you may also need to add a selector like the one below to the services (not PVCs) of oredge-admin-database and oredge-log-server-database. Replace <node-name> with the name of the Kubernetes Node where the current service is located.

spec:
  template:
    spec:
      nodeSelector:
        kubernetes.io/hostname: <node-name>

## 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`:

```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

If you are deploying Edge Node in a non-Kubernetes environment, please refer to this document for the upgrade process: Upgrading OpenResty Edge Node.

Before upgrading each POD related to oredge-node, please ensure that the newly started Edge Node has synchronized all configurations.

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. :)