Accessing the Varnish Controller from outside the Kubernetes cluster can be achieved by port-forwarding or exposing the Varnish Controller UI via Ingress. Port forwarding is suitable for intermittent access to the Varnish Controller UI, while Ingress allows for more permanent access but requires an Ingress controller to be set up in the cluster.
To establish a port-forwarding, run the following command:
$ kubectl port-forward svc/varnish-controller-ui 8888:80
Once the port forwarding is set up, the Varnish Controller UI can be accessed at http://localhost:8888/
To configure Varnish Controller with Ingress, apply the following configuration:
ui:
enabled: true
ingress:
enabled: true
hosts:
- host: varnish-controller.example.com
paths: []
By default, Kubernetes only exposes the service via an HTTP port (80). To enable HTTPS, install a TLS certificate as a secret and apply the following configuration:
ui:
ingress:
tls:
- hosts:
- varnish-controller.example.com
secretName: varnish-controller-tls
It is also necessary to update the DNS server to point varnish-controller.example.com to the IP address of the cluster’s Ingress. The Ingress IP address can be retrieved by running the following command:
$ kubectl get ingress