Deploying OpenResty Edge in Kubernetes

Before you begin deployment, please ensure you have set up a Kubernetes cluster.

Download Deployment File

First, navigate to the OpenResty Company’s Download Center to download the latest deployment file openresty-edge-VERSION.yml.

Adjust Deployment File

After downloading the deployment file, please adjust the following configuration according to your specific situation:

  1. Modify storageClassName to match the storage class name in your cluster. The default storageClassName in the configuration file is local-path.

You may also adjust the following configurations according to your needs (optional):

  1. The default port for the Edge Admin Web service is set to 30443, with the default type being NodePort.
  2. By default, The Edge Node service is exposed externally through the LoadBalancer type.
  3. The Persistent Volume Claim (PVC) size for the Edge Admin database, the Edge Log Server database, and the Edge Node. The Edge Admin and Edge Log Server databases are configured for 200GB by default. For each Edge Node instance, the default is configured for 100GB, which is used to store the Edge Node’s configuration, proxy cache, and logs. If you run 10 Edge Node instances, these Edge Nodes will collectively be allowed to consume up to 1000GB of storage space.

Execute OpenResty Edge Deployment

After making the necessary adjustments to the deployment file, you can use the kubectl command line tool to deploy OpenResty Edge.

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

The --server-side=true option is used here because some of the configurations in the deployment file may exceed the limits of the kubectl client mode.

The deployment process will create the following resources:

  • A namespace named openresty-edge
  • A secret named openresty-edge-registry-secret for pulling OpenResty Edge images
  • Four ConfigMaps, corresponding to the OpenResty Edge configuration package (openresty-edge-config-package), Edge Admin configuration (oredge-admin-config-ini), Edge Log Server configuration (oredge-log-server-config-ini), and Edge Node configuration (oredge-node-config-ini)
  • Four StatefulSets, respectively corresponding to the Edge Admin database (oredge-admin-database), Edge Log Server database (oredge-log-server-database), Edge Admin (oredge-admin), and Edge Node (oredge-node)
  • A Deployment for the Edge Log Server (oredge-log-server)
  • Five services corresponding to the Edge Admin Database, Edge Admin, Edge Log Server Database, Edge Log Server, and Edge Node
  • Two PVCs, respectively, for the Edge Admin database and the Edge Log Server database
  • Several PVCs, each for every Edge Node instance

Confirm Deployment Status

After deployment, you can check the status of the pods to confirm whether OpenResty Edge has been deployed correctly.

kubectl get pods -n openresty-edge

Ensure all OpenResty Edge related pods are in the Running state.

Accessing OpenResty Edge

You can obtain the address information needed to access the Edge Admin Web by looking up the configuration of the services:

kubectl get svc -n openresty-edge

After obtaining the service information related to OpenResty Edge, use the returned external IP address or domain name to access the OpenResty Edge Web interface: https://KUBERNERTES_NODE_IP:30443.

The username to use for login is: admin;

The password can be extracted from the deployment file:

grep -A 1 'EDGE_ADMIN_INIT_PASSWORD' openresty-edge-VERSION.yml | grep value | awk -F "'" '{print $2}'

With this, the deployment is complete.