evry-bergen / knative-workshop Goto Github PK
View Code? Open in Web Editor NEWKnative & Istio Workshop on Google Cloud for Booster 2019
Home Page: https://knative.club
Knative & Istio Workshop on Google Cloud for Booster 2019
Home Page: https://knative.club
Set up custom domain for Knative serving.
The example-module contains an example of a Node.js module with a dependency.
It also, instead of a Service, has individual build yaml files and routes that you can edit.
List configurations and their age:
kubectl get configuration.serving.knative.dev
Optionally use kubectl describe configuration.serving.knative.dev/[name from list]
to see status.
List the builds that have been generated:
kubectl get build.build.knative.dev
Builds sometimes fail, so let's hope your Knative vendor provides easy access
to logs
indexed for your build. In the meantime let's use kubectl
and the step names
from the build template (assuming the generated steps "creds-initializer" and
"git-source" succeed).
SELECTOR="build-name=nodejs-runtime-example-module-00001"
kubectl logs -l $SELECTOR -c build-step-dockerfile
kubectl logs -l $SELECTOR -c build-step-export
Now Knative should look up the image digest and produce an exact revision spec:
kubectl get revision.serving.knative.dev
... and the generated deployment should have the image digest (which Serving looks up) set:
kubectl get deploy/nodejs-runtime-example-module-00001-deployment -o=jsonpath='{.spec.template.spec.containers[0].image}{"\n"}'
... and it will bing up a pod. Logs for that are found using:
kubectl logs -l serving.knative.dev/configuration=nodejs-runtime-example-module -c user-container
If no pod is brought up you might want to look for error messages in kubectl get configuration.serving.knative.dev/nodejs-runtime-example-module -o yaml
.
You might also want to look for pull errors etc in the generated deployment kubectl describe deploy/nodejs-runtime-example-module-00001-deployment
.
If a pod is running, create a route and use describe
to see your public and local URL.
kubectl apply -f route-r00001.yaml
kubectl describe route.serving.knative.dev/nodejs-runtime-example-module
To test the route through the cluster's internal name.
kubectl run -i -t knative-test-client --image=gcr.io/cloud-builders/curl --restart=Never --rm -- \
-H 'Host: nodejs-runtime-example-module.default.example.com' \
-H 'Content-Type: text/plain' \
-d 'Aguid this!' \
--connect-timeout 3 --retry 10 -vSL -w '\n' \
http://knative-ingressgateway.istio-system.svc.cluster.local/
If the function call worked your response from curl is the deterministic UUID.
The function source is fixed in this example, but its output can be altered using the SALT env. To Knative a new image digest and a new env value are both valid causes for generating a new Revison.
Hence we trigger an almost identical build.
kubectl apply -f build-r00002.yaml
There's an example route which directs 50% of the traffic to each of the two revisions.
kubectl apply -f route-r00002.yaml
Now we can test repeated calls:
kubectl run -i -t knative-test-client --image=gcr.io/cloud-builders/curl --restart=Never --rm -- \
-H 'Host: nodejs-runtime-example-module.default.example.com' \
-H 'Content-Type: text/plain' \
-d 'Aguid this!' \
-s -w '\n' \
http://knative-ingressgateway.istio-system.svc.cluster.local/?test=[1-20]
error pushing image: failed to push to destination eu.gcr.io/starlit-casing-234321/app-from-source:latest: no token in bearer response: {"errors":[{"code":"UNAUTHORIZED","message":"Not Authorized."}]}
https://cloud.google.com/container-registry/docs/access-control
Ensure you have pushed an image to Container Registry in the wanted host location (for example, asia.gcr.io). Container Registry creates a storage bucket when you push the first image to a host location, and you need this storage bucket to exist to be able to set permissions on it or set up an encryption key.
--
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.