GithubHelp home page GithubHelp logo

evry-bergen / knative-workshop Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 11.0 6.61 MB

Knative & Istio Workshop on Google Cloud for Booster 2019

Home Page: https://knative.club

HCL 72.70% HTML 1.17% Dockerfile 0.75% Go 7.35% Smarty 18.02%
docker istio knative kubernetes serverless workshop

knative-workshop's People

Contributors

haakonmb avatar haavare avatar randax avatar starefossen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

knative-workshop's Issues

Lab x: Knative Routes

Example of routes and builds

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.

Build your next revision and route traffic

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]

Source: https://github.com/triggermesh/nodejs-runtime

Lab 2: Push to GCR UNAUTHORIZED

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.

Automatisert oppsett

  • GKE setup
  • Enable managed Istio
  • knative install

--

  • circleci deployment
  • autoamated teardown

Presentasjon

  • kubernetes / gke
  • istio
  • knative
  • setup
  • lab assignments overview

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.