Please edit the object below. Lines beginning with a '#' will be ignored,

PSPDFKit Processor has been deprecated and replaced by Document Engine. To migrate to Document Engine and unlock advanced document processing capabilities, refer to our migration guide. Learn more about these enhancements on our blog.

This guide will walk you through the steps for deploying PSPDFKit Processor to the Microsoft Azure Kubernetes Service(opens in a new tab) with Kubernetes(opens in a new tab).

Setting Up Azure CLI

To deploy PSPDFKit Processor to the Microsoft Azure Kubernetes Service(opens in a new tab) with Kubernetes(opens in a new tab), you have to set up the Azure CLI(opens in a new tab) utility to manage your Kubernetes(opens in a new tab) cluster in the command line.

To install Azure CLI(opens in a new tab), follow the installation instructions from the Azure CLI installation guide(opens in a new tab).

After you’ve installed Azure CLI(opens in a new tab), run the following command to log in to Microsoft Azure(opens in a new tab):

Terminal window
az login

This command will print the URL https://microsoft.com/devicelogin(opens in a new tab) and the code for signing in. Open the URL in your browser and enter the code to sign in to your Microsoft Azure(opens in a new tab) account.

Sign in Page

Creating a Resource Group

To create a resource group, run the following:

Terminal window
az group create -l eastus -n pspdfkitresourcegroup

In this example, we created the resource group in the eastus region with the name pspdfkitresourcegroup. An overview of available regions can be found on Microsoft’s Azure geographies(opens in a new tab) page.

Creating a Kubernetes Cluster

To manage your Kubernetes(opens in a new tab) cluster from the command line, you have to install kubectl(opens in a new tab):

Terminal window
az aks install-cli

To create a Kubernetes(opens in a new tab) cluster with the name pspdfkitAKScluster, run the following:

Terminal window
az aks create -g pspdfkitresourcegroup --name pspdfkitAKScluster --generate-ssh-keys

ℹ️ Note: Microsoft Azure trials are limited to four vCPUs. aks create needs six vCPUs by default (three nodes × two CPUs of Standard_D2 VM size). To create a cluster within free account limits, we recommend the following to generate a cluster with two nodes each using the default Standard_D2 VM size:

Terminal window
az aks create -g pspdfkitresourcegroup --name pspdfkitAKScluster --generate-ssh-keys --node-count 2

To connect kubectl(opens in a new tab) with your cluster, execute:

Terminal window
az aks get-credentials -g pspdfkitresourcegroup -n pspdfkitAKScluster

Creating a ConfigMap

ConfigMaps(opens in a new tab) allow you to decouple configuration artifacts from image content. To create the pspdfkit-config ConfigMap(opens in a new tab), run the following command:

Terminal window
kubectl create configmap pspdfkit-config

After the ConfigMap(opens in a new tab) is created, you can edit it with the following:

Terminal window
kubectl edit configmap pspdfkit-config

This will open the created ConfigMap(opens in a new tab) in your editor. Edit the file to match the following file, and replace activation_key with your activation key:

# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving,
# this file will be reopened with the relevant failures.
#
apiVersion: v1
data:
api_auth_token: secret
license_key: YOUR_LICENSE_KEY_GOES_HERE
kind: ConfigMap

Don’t change anything that comes after the kind: ConfigMap line, because that part is autogenerated.

Creating Deployments

To run PSPDFKit Processor, you have to define a Deployment for PSPDFKit Processor. Kubernetes Deployments(opens in a new tab) can be configured in a file. To do so, you’ll need to create the configuration for PSPDFKit Processor (processor.yml) and ensure that the pspdfkit/processor image tag corresponds to the latest PSPDFKit Processor version:

apiVersion: v1
kind: Service
metadata:
name: processor
spec:
ports:
- protocol: TCP
port: 5000
targetPort: 5000
selector:
app: processor
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: processor
spec:
selector:
matchLabels:
app: processor
template:
metadata:
labels:
app: processor
spec:
containers:
- image: "pspdfkit/processor:2023.11.1"
name: processor
env:
- name: ACTIVATION_KEY
valueFrom:
configMapKeyRef:
name: pspdfkit-config
key: license_key
- name: API_AUTH_TOKEN
valueFrom:
configMapKeyRef:
name: pspdfkit-config
key: api_auth_token
ports:
- containerPort: 5000
name: processor

To create the Deployments needed to run PSPDFKit Processor, execute:

Terminal window
kubectl create -f ./pspdfkit-processor.yml

Accessing the Processor Service

To access this new Processor instance, you have to get the external IP address that was assigned to the service. Run the following command to view all the Services in your cluster, along with their assigned external IP addresses:

Terminal window
kubectl get services

This will show something like the following:

Terminal window
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.15.240.1 <none> 443/TCP 54m
processor LoadBalancer 10.15.247.197 12.345.678.910 5000:32393/TCP 1m

Copy the EXTERNAL-IP address from the processor row and use it together with the port 5000 in your web browser. In this example, you’ll use http://12.345.678.910:5000/. This will present you with a welcome message:

PSPDFKit Processor is up and running.

You just confirmed that your Processor instance is up and running. You can now post processing requests. For example:

Terminal window
curl -H "Authorization: Token token=secret" \
-F operations="{\"operations\":[{\"type\": \"rotatePages\",\"pageIndexes\": \"all\",\"rotateBy\": 90}]}" \
http://12.345.678.910:5000/process \
--output result.pdf

Limitations

Be aware that this is just an example setup, and we recommend looking deeper into the Microsoft Azure Kubernetes Service(opens in a new tab) for a production-ready setup.