Listens on http port 7114
and serves files from the pod's /var/www
subdirectory.
Listens on https port 7143
and serves files from the pod's /var/www
subdirectory.
- bash, jq, nc
- Kubernetes (e.g. Docker Desktop with Kubernetes enabled)
- kubectl
- helm 3.0+
- curl
The setup.sh
script:
- installs Zilla to the Kubernetes cluster with helm and waits for the pod to start up
- copies the contents of the www directory to the Zilla pod
- starts port forwarding
./setup.sh
output:
+ ZILLA_CHART=oci://ghcr.io/aklivity/charts/zilla
+ helm upgrade --install zilla-http-filesystem oci://ghcr.io/aklivity/charts/zilla --namespace zilla-http-filesystem --create-namespace --wait [...]
NAME: zilla-http-filesystem
LAST DEPLOYED: [...]
NAMESPACE: zilla-http-filesystem
STATUS: deployed
REVISION: 1
NOTES:
Zilla has been installed.
[...]
++ kubectl get pods --namespace zilla-http-filesystem --selector app.kubernetes.io/instance=zilla -o json
++ jq -r '.items[0].metadata.name'
+ ZILLA_POD=zilla-1234567890-abcde
+ kubectl cp --namespace zilla-http-filesystem www zilla-1234567890-abcde:/var/
+ nc -z localhost 7114
+ kubectl port-forward --namespace zilla-http-filesystem service/zilla 7114 7143
+ sleep 1
+ nc -z localhost 7114
Connection to localhost port 7114 [tcp/http-alt] succeeded!
curl http://localhost:7114/index.html
output:
<html>
<head>
<title>Welcome to Zilla!</title>
</head>
<body>
<h1>Welcome to Zilla!</h1>
</body>
</html>
curl --cacert test-ca.crt https://localhost:7143/index.html
output:
<html>
<head>
<title>Welcome to Zilla!</title>
</head>
<body>
<h1>Welcome to Zilla!</h1>
</body>
</html>
The teardown.sh
script stops port forwarding, uninstalls Zilla and deletes the namespace.
./teardown.sh
output:
+ pgrep kubectl
99999
+ killall kubectl
+ helm uninstall zilla-http-filesystem --namespace zilla-http-filesystem
release "zilla-http-filesystem" uninstalled
+ kubectl delete namespace zilla-http-filesystem
namespace "zilla-http-filesystem" deleted