Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/minghsu0107/k8s-varnish-nginx

This repository domonstrates how to deploy Varnish, a high-performance caching HTTP reverse proxy, on Kubernetes.
https://github.com/minghsu0107/k8s-varnish-nginx

caching kubernetes varnish

Last synced: 5 days ago
JSON representation

This repository domonstrates how to deploy Varnish, a high-performance caching HTTP reverse proxy, on Kubernetes.

Awesome Lists containing this project

README

        

# k8s-varnish-nginx
This repository domonstrates how to deploy Varnish, a high-performance caching HTTP reverse proxy, on Kubernetes.
## Deployment
Apply manifests:
```bash
kustomize build manifests | kubectl apply -f -
```
## Testing
Open port-forward to varnish service:
```bash
kubectl -n demo port-forward svc/varnish 8008:80
```
Test whether caching works:
```bash
curl -v http://localhost:8008
```
Example of a successful response:
```
* Trying 127.0.0.1:8008...
* Connected to localhost (127.0.0.1) port 8008 (#0)
> GET / HTTP/1.1
> Host: localhost:8008
> User-Agent: curl/7.79.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Mon, 11 Jul 2022 09:03:33 GMT
< Content-Type: text/html
< Content-Length: 615
< Last-Modified: Mon, 23 May 2022 23:59:19 GMT
< ETag: "628c1fd7-267"
< Age: 21
< Accept-Ranges: bytes
< X-Cache-Hits: 3
< X-Cache: cached
< Connection: keep-alive
<

Welcome to nginx!

html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }

Welcome to nginx!


If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.

For online documentation and support please refer to
nginx.org.

Commercial support is available at
nginx.com.

Thank you for using nginx.

* Connection #0 to host localhost left intact
```
We can see that Varnish has cached the Nginx welcome page for us, resulting in `X-Cache: cached` and `X-Cache-Hits: 3`.