Search
Varnish Helm Chart

Varnish Controller Agent

The Varnish Enterprise Helm Chart provides seamless integration with Varnish Controller Agent.

Basic configuration

To deploy Varnish Controller Agent as a sidecar to Varnish Enterprise, set server.agent.enabled to true and set server.secret:

---
server:
  # ...previous configurations

  secret: "RandomVarnishSecretString"

  agent:
  	enabled: true

It is also possible to configure a tag and a location for Varnish Controller Agent in server.agent.tags, and server.agent.location, respectively:

server:
  # ...previous configurations

  secret: "RandomVarnishSecretString"

  agent:
    enabled: true

    tags:
      - "tokyo-dc"

    location:
      latitude: "35.652832"
      longitude: "139.839478"

Configuring NATS

If Varnish Controller is deployed in a different namespace than Varnish Enterprise but within the same Kubernetes cluster, set global.natsServer.internal.namespace:

---
global:
  # ...previous configurations

  natsServer:
    internal:
      namespace: "varnish-controller"

server:
  # ...previous configurations

  agent:
    enabled: true

If Varnish Controller is deployed outside the Kubernetes cluster or is using an external NATS server not provided by the Varnish Controller Helm Chart, set global.natsServer.internal.enabled to false and configure global.natsServer.externalAddress:

---
global:
  # ...previous configurations

  natsServer:
    externalAddress: "nats://external-nats.example.com:4222"
    internal:
      enabled: false

Enabling state persistency

Varnish Controller Agent can store its last known good state on a disk. Persisting state on a disk provides extra resiliency and allows Varnish Enterprise and Varnish Controller to use the last known good state when it cannot connect to NATS.

Using statefulSet

The Varnish Enterprise Helm Chart can automatically provision a backing persistent disk when Varnish Enterprise Pod is deployed as a StatefulSet (server.kind set to StatefulSet):

---
server:
  # ...previous configurations

  agent:
    persistence:
      enabled: true
      storageSize: "512Mi"

Using hostPath

Since volumeClaimTemplates in Kubernetes is only available for StatefulSet, a custom volume mount is required to enable state persistency. For example, to enable state persistency with hostPath in DaemonSet:

---
server:
  # ...previous configurations

  agent:
    persistence:
      enableWithVolumeName: agent-hostpath

   extraVolumes:
    - name: agent-hostpath
      hostPath:
        path: /data/varnish-controller-agent

The /data/varnish-controller-agent path must already exist on the node, with appropriate permissions, according to securityContext. By default, the Varnish Helm Chart runs under UID 999. To prepare /data/varnish-controller-agent on each node:

$ sudo mkdir /data/varnish-controller-agent
$ sudo chown 999:999 /data/varnish-controller-agent