How to Deploy TypeScript 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 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 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 DOCX 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 DOCX 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 DOCX Editor service.

kubectl get all

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

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

For more details about the Azure Kubernetes service, refer to the Azure Kubernetes Service for a production-ready setup.