An http service that calls another service
2.4K
This guide is brief on howto stuff. It refers to official docs instead. The choice of test case detauls - images, commands etc - differs from these official docs to try to offer insights by slight variation.
To use Gogs locally run kubectl -n git port-forward gogs-0 3000.
Log in as user knative passwod knative at http://localhost:3000/,
or run things like git clone http://knative:knative@localhost:3000/myOrg/myRepo.
See the docs. Unless otherwise stated, we try to keep this guide up-to-date with the most recent releases.
Throughout this guide we'll use the alias kcurl to refer to HTTP connections to the
knative ingressgateway.
The details depend on how you host your test cluster.
# minikube
alias kcurl="curl --connect-to :80:$(minikube ip):32380"
With this alias and nothing deployed we expect a 404 using any hostname, kcurl -vf nonexistent.example.com,
assuming our cluser uses the default hostname.
kubectl apply -f service-from-image/echo.yaml
# wait and all that
kcurl -vf echo.default.example.com
Let's assume you have CI that builds docker images, and want to use the Knative revision feature for Blue-Green Deployment. Imagine you did some coding, and waited for Jenkins :), inbetween these steps:
kubectl apply -f service-from-image/revisions-1.yaml
until kcurl revisions.default.example.com | grep Build1; do sleep 1; done;
kubectl apply -f service-from-image/revisions-2.yaml
until kcurl revisions.default.example.com | grep Build2; do sleep 1; done;
kubectl apply -f service-from-image/revisions-3.yaml
until kcurl revisions.default.example.com | grep Build3; do sleep 1; done;
We all love terminals, but ....
Let's dive into Knative's choice of visualizations sooner rather than later:
If you have a graph, let's apply a Route that is independent of our example Configuration and look under the hood of Grafana using a Prometheus Requests Per Second query like rate(istio_revision_request_count{destination_configuration="revisions"}[1m]):
kubectl apply -f service-from-image/revisions-blue-green-route.yaml
while true; do sleep .1 && time kcurl revisions-blue-green.default.example.com; done
To make request tracing a bit more interesting, and to deponstrate source to url, we can interate on some code that depends on a service in the same namespace.
Because I'm having problems with gcr.io at the moment which blocks local builds, the code is also built at https://hub.docker.com/r/solsson/knative-training-frontend.
Content type
Image
Digest
Size
2 MB
Last updated
about 8 years ago
docker pull solsson/knative-training-frontend