How to deploy word processor server docker container in azure kubernetes service in React Document editor component

20 Mar 20232 minutes to read

Prerequisites

az login

Step 1: Create a resource group.

Create a resource group using the az group create command.

The following example creates a resource group named documenteditorresourcegroup in the eastus location.

   az group create --name documenteditorresourcegroup --location "East US"

Step 2: Create AKS cluster.

Use the az aks create command to create an AKS cluster. The following example creates a cluster named documenteditorcluster with one node.

    az aks create --resource-group documenteditorresourcegroup --name documenteditorcluster --node-count 1

Step 3: Connect to the cluster.

Install the kubectl into the workspace using the following command.

    az aks install-cli

To configure kubectl to connect to your Kubernetes cluster, use the az aks get-credentials command. This command downloads credentials and configures the Kubernetes CLI to use them.

   az aks get-credentials --resource-group documenteditorresourcegroup --name documenteditorcluster

Step 4: Create Kubernetes Services and Deployments

Kubernetes Services and Deployments can be configured in a file. To run the Document Editor server, you must define a Service and a Deployment documenteditorserver. To do this, create the documenteditor-server.yml file in the current directory using the following code.

```    apiVersion: apps/v1    kind: Deployment
metadata:    labels:
app: documenteditorserver   name: documenteditorserver   spec:   replicas: 1   selector:
matchLabels:
  app: documenteditorserver   strategy: {}   template:
metadata:
  labels:
    app: documenteditorserver
spec:
  containers:
  - image: syncfusion/word-processor-server:latest
    name: documenteditorserver
    ports:
    - containerPort: 80
    env:
    - name: SYNCFUSION_LICENSE_KEY
      value: "YOUR_LICENSE_KEY"

apiVersion: v1
kind: Service
metadata:
labels:
app: documenteditorserver
name: documenteditorserver
spec:
ports:

  • port: 80
    targetPort: 80
    selector:
    app: documenteditorserver
    type: LoadBalancer
    ```

Step 5: To create all Services and Deployments needed to run the Document Editor server, execute the following.

   kubectl create -f ./documenteditor-server.yml

Run the following command to get the Kubernetes cluster deployed service details and copy the external IP address of the Document Editor service.

   kubectl get all

Browse the copied external IP address and navigate to the Document Editor Web API control http://<external-ip>/api/documenteditor. It returns the default get method response.

Step 6: Append the Kubernetes service running the URL http://<external-ip>/api/documenteditor/ to the service URL in the client-side Document Editor control. For more information about the Document Editor control, refer to this getting started page.

For more details about the Azure Kubernetes service, please look deeper into Microsoft Azure Kubernetes Service for a production-ready setup.