Remove the demo Ingress and its generated Gateway, apply k8s/gateway.yaml, and send requests through the entry point; --resolve supplies the DNS record a real domain would have:
kubectl delete ingress shop >/dev/null && kubectl delete gateway kind-ingress-gateway >/dev/null
kubectl apply -f k8s/gateway.yaml
kubectl wait --for=condition=Programmed gateway/booknest --timeout=60s >/dev/null
kubectl get gateway booknest
IP=$(kubectl get gateway booknest -o jsonpath='{.status.addresses[0].value}')
curl -s --resolve books.example.com:80:$IP http://books.example.com/version; echo
curl -s --cacert ~/books.crt --resolve books.example.com:443:$IP \
https://books.example.com/api/books/3 | cut -c1-70
curl -s -o /dev/null -w '%{http_code}\n' -H 'Host: shop.example.com' http://$IP/
docker ps --filter name=kindccm-gw --format '{{.Names}} {{.Ports}}' | cut -d, -f1,3Output
gateway.gateway.networking.k8s.io/booknest created
httproute.gateway.networking.k8s.io/booknest created
NAME CLASS ADDRESS PROGRAMMED AGE
booknest cloud-provider-kind 172.18.0.5 True 5s
{"version":"1.4.0"}
{"id":3,"title":"Salt and Saffron","author":"Priya Nair","genre":"Cook
404
kindccm-gw-06379590c43f 0.0.0.0:32796->80/tcp, 0.0.0.0:32797->443/tcpHTTP and HTTPS both reached the API, and an unknown host got Envoy 117,531 's 404. The kind 14,561 network is not routable from Windows, so Docker 514 publishes Envoy's ports 80 and 443 on ephemeral host ports (last line): map books.example.com to 127.0.0.1 in the Windows hosts file and browse to that name with the port shown.
The NodePort from Exposing BookNest is now redundant. Delete type: NodePort and nodePort: 30080 from k8s/web.yaml, apply it, and commit:
kubectl apply -f k8s/web.yaml | grep service && kubectl get service web
curl -s -m 3 http://127.0.0.1:33080/ || echo "33080: no answer"
git add k8s/gateway.yaml k8s/web.yaml
git commit -qm "Route BookNest through a Gateway and retire the web NodePort"Output
service/web configured NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE web ClusterIP 10.96.98.219 <none> 80/TCP 15m 33080: no answer