Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introducing Knative to Small Teams

Introducing Knative to Small Teams

Knative is a powerful and small serverless platform you can install into any Kubernetes cluster to allow developers to build, deploy, scale up and down, and even consume/publish events.

https://starkandwayne.com/blog/introduction-to-knative/

Other links mentioned in slide deck:

https://cloud.google.com/knative/
https://github.com/cppforlife/knctl
https://github.com/cppforlife/kwt
https://github.com/starkandwayne/knative-env
https://github.com/drnic/ruby-meetup-2018-11-27

Cb2b768a5e546b24052ea03334e43676?s=128

Dr Nic Williams

November 27, 2018
Tweet

Transcript

  1. Title Text Body Level One Body Level Two Body Level

    Three Body Level Four Body Level Five Introducing Knative to Small Teams Dr Nic Williams @drnic
  2. Knative @drnic Build
 Source code to Docker ɑ Serving
 Run

    containers; Route traffic Eventing
 Publish & subscribe to events Kubernetes
 Containers on any cloud
  3. https://starkandwayne.com/blog/introduction-to-knative/

  4. knctl deploy -s meetup --image drnic/meetup:v1 Serving
 Run containers; Route

    traffic myblog.com/first-post Routing 3+ Pods https://starkandwayne.com/blog/deploying-12factor-apps-to-knative/ ɂ
  5. Autoscaling
 No traffic, no containers __ https://starkandwayne.com/blog/deploying-12factor-apps-to-knative/ myblog.com/post Routing 3

    Pods ɂ <no traffic> Routing 0 Pods ɂ
  6. knctl deploy -s meetup --image drnic/meetup:v1 Serving
 Revisions have separate

    routing knctl deploy -s meetup --image drnic/meetup:v2 myblog.com/post Routing v2 - 3 Pods ɂ v1 - 0 Pods
  7. knctl deploy -s meetup --image drnic/meetup:v2 \ --env TARGET="revision 3"

    Serving
 Revisions have separate routing myblog.com/post Routing v3 - 3 Pods ɂ v1 - 0 Pods v2 - 0 Pods
  8. Serving
 Rollout new revisions gradually $ knctl revisions list Service

    Name Tags Conditions Age Traffic meetup meetup-00003 latest 4 OK / 4 48s 100% -> meetup.default.example.com ~ meetup-00002 previous 4 OK / 4 1m - ~ meetup-00001 - 4 OK / 4 10m - $ knctl deploy -s meetup --image drnic/meetup:v2 --env TARGET="revision 4" \ --managed-route=false $ knctl rollout --route meetup -p meetup:previous=50% -p meetup:latest=50% $ knctl revisions list Service Name Tags Conditions Age Traffic meetup meetup-00004 latest 4 OK / 4 4m 50% -> meetup.default.example.com ~ meetup-00003 previous 4 OK / 4 6m 50% -> meetup.default.example.com
  9. Local traffic
 kwt is your friend $ sudo -E kwt

    net start --dns-map-exec='knctl dns-map' $ curl meetup.default.example.com $ watch -n1 curl -sS meetup.default.example.com https://github.com/cppforlife/kwt
  10. Build & Serving
 Deploy from Dockerfile git clone https://github.com/cppforlife/simple-app cd

    simple-app cat Dockerfile knctl deploy \ --service simple-app \ --directory . \ --service-account build \ --image drnic/simple-app \ --env SIMPLE_MSG="Hello Ruby people"
  11. Build & Serving
 Deploy from Buildpack git clone https://github.com/starkandwayne/knative-env cd

    knative-env knctl deploy -d . \ --service knative-env \ --service-account build \ --template buildpack \ --image drnic/knative-env
  12. Installation
 Knative on Kubernetes kubectl version knctl install Ingress
 DNS

    to ingress gateway https://starkandwayne.com/blog/public-traffic-into-knative-on-gke/ https://starkandwayne.com/blog/adding-a-custom-domain-for-knative-services/
  13. Knative @drnic Build
 Source code to Docker ɑ Serving
 Run

    containers; Route traffic Eventing
 Publish & subscribe to events
  14. https://starkandwayne.com/blog/introduction-to-knative/ https://github.com/cppforlife/knctl https://github.com/cppforlife/kwt https://cloud.google.com/knative/ https://github.com/starkandwayne/knative-env https://github.com/drnic/ruby-meetup-2018-11-27