> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/web/webviewer-server/deployment/wv-server-kubernetes-deployment.md).

# Deploy WebViewer Server with Kubernetes

In this guide, we'll walk you through setting up WebViewer Server in Kubernetes and deploying our pre-made Helm chart. Using the Helm chart resolves typical deployment issues that can occur when using

Kubernetes is a container orchestration system that can be used to deploy WebViewer Server. For more detailed information on Kubernetes, please review the [Kubernates documentation](https://kubernetes.io/docs/home/).

In this guide, we'll walk you through setting up WebViewer Server in Kubernetes and deploying our pre-made [Helm chart](https://helm.sh/). Using the Helm chart resolves typical deployment issues that can occur when using Kubernates to deploy WebViewer Server.

{% hint style="info" %}
The Helm chart is designed to be a starting point for your infrastructure. We do not actively support alterations to this Helm chart or managing infrastructure in your environment. While it will work out of the box, you will have to alter and manage the chart yourself.

We do not recommend you use this in a production environment without first verifying your setup and environment yourself.
{% endhint %}

<a href="https://downloads.apryse.com/downloads/server/wvs-k8s-helm.zip" class="button primary">WVS Helm Chart</a>

### How the Helm chart helps with deployment

WebViewer Server can be difficult to deploy in the traditional scheme of Kubernetes because:

* WebViewer Server requires sticky sessions.
* WebViewer Server uses a persistent cache and requires high throughput on read and write.

To address these issues, the Helm chart uses the following configuration:

* Deployed WebViewer Server pods as headless.
  * All WebViewer Server pods are provided their own IP for proper sticky routing by HAProxy.
* HAProxy is placed in front of WebViewer Server to manage routing and stickiness.
  * Within HAProxy, we use the dynamic Kubernetes DNS resolver to make sure we can respond to deployment adjustments.
  * We've added stickiness using our [BCID query parameter](/web/get-started/faq/what-is-the-bcid.md) and stick tables.
* For each WebViewer Server pod, we've added a persistent volume mounted to their `/home/tomcat/wv-server/static_data` path.
* Prometheus integration to support the tracking of scaling metrics

Below is a diagram of how this infrastructure is constructed:

![](https://3532544125-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FX9YnTSKIHvV7m0A36LbO%2Fuploads%2Fgit-blob-a6242e15bced74214c91a828c8dd7272ddbee4a2%2Fe4b160aed51a80a2a01cd7e0483b4e4bdd47922e-522x281.png?alt=media)

### Configure the Helm Chart

The Helm chart contains a `values.yaml` file which contains variables you can alter. They are as follows:

{% tabs %}
{% tab title="YAML" %}
{% code lineNumbers="true" %}

```yaml
webviewerserver:
  image: pdftron/webviewer-server
  tag: latest
  port: 8090
  includedemo: true
  maxcachesize: 7500
  max_instances: 10

hpa:
  minReplicas: 1
  maxReplicas: 10
  scaleThresholdMilliseconds: 10000

kube-prometheus-stack:
  prometheus:
    prometheusSpec:
      scrapeInterval: "15s"
  grafana:
    enabled: true
  alertmanager:
    enabled: true

haproxy:
  image: haproxy:2.9
  port: 80
  servicePort: 80


```

{% endcode %}
{% endtab %}
{% endtabs %}

In the above code, the only items you should modify, in normal operation, are:

* `image`: The name of the WebViewer Server docker image to use.
* `tag`: The tag of the WebViewer Server docker image you wish to use.
* `max_instances`: The maximum number of WebViewer Server instances you wish to allow the scale to go to.
* `minReplicas`: The minimum required instances of WebViewer Server.
* `maxReplicas`: The maximum possible instances of WebViewer Server. The number should be set to the same value as `max_instances`.
* `scaleThresholdMiliseconds`: The number of milliseconds of acceptable average delay for customer jobs. If this value is exceeded for the scale window, a new WebViewer Server instance will be added.

### Deploy the Helm Chart

Our Helm chart can be used to deploy a Kubernetes setup and ready to go with built in autoscaling and Prometheus monitoring.

To deploy the Helm chart, download the chart using the download button in the introduction section of this article above, extract it, and navigate to the extracted folder. Execute the following command:

{% hint style="info" %}
Keep in mind you will have to have already connected to your existing Kubernetes cluster and have setup Helm for it.
{% endhint %}

{% tabs %}
{% tab title="Bash" %}
{% code lineNumbers="true" %}

```bash
helm install apryse-webviewer-server ./
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/web/webviewer-server/deployment/wv-server-kubernetes-deployment.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
