How to Deploy JavaScript DOCX Editor Docker Image on AKS

28 Aug 20263 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 East US location.

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

Step 2: Create an 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 kubectl in your 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 the Kubernetes Service and Deployment

Kubernetes Services and Deployments can be configured in a file. To run the DOCX Editor server, you must define a Service and a Deployment named 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
  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 DOCX Editor server, run the following command.

kubectl create -f ./documenteditor-server.yml

Run the following command to get the deployed Kubernetes Service details and copy the external IP address of the DOCX Editor Service.

kubectl get all

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

Step 6: Append the running Kubernetes Service URL http://<external-ip>/api/documenteditor/ to the serviceUrl in the client-side DOCX Editor control. For more information about the DOCX Editor control, refer to the Getting Started page.

For more details about the Azure Kubernetes Service, see Microsoft Azure Kubernetes Service for a production-ready setup.