HUB
Sign inSign up

solsson/knative-training-frontend

By solsson

•Updated about 8 years ago

An http service that calls another service

Image
0

2.4K

solsson/knative-training-frontend repository overview

⁠Knativde Training Resources

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.

⁠Local Git

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.

⁠Set up knative serving

See the docs⁠. Unless otherwise stated, we try to keep this guide up-to-date with the most recent releases.

⁠Act as client

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⁠.

⁠The basic Serving example

https://github.com/knative/docs/blob/master/install/getting-started-knative-app.md#configuring-your-deployment⁠

kubectl apply -f service-from-image/echo.yaml
# wait and all that
kcurl -vf echo.default.example.com

⁠New revisions using pre-built images

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;

⁠Are you having fun?

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

⁠Source-to-URL

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⁠.

Tag summary

Content type

Image

Digest

Size

2 MB

Last updated

about 8 years ago

docker pull solsson/knative-training-frontend