Coder Social home page Coder Social logo

andrewwebber / learn-knative Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 1.0 803 KB

Quick hands-on introduction to Knative

Shell 45.00% Dockerfile 5.15% Python 21.59% Rust 9.17% Go 5.76% JavaScript 4.72% Makefile 0.26% TypeScript 8.34%
knative knative-serving knative-eventing knative-tutorial

learn-knative's Introduction

Learning Knative - Quickstart

Local Knative dev environment

  • Kourier or Istio
  • Kafka or in-memory broker
  • Kind or K3D
  • Loki observability

Introduction

The outcome of this exercise is a setup where services written in multiple languages get auto-scaled as cloudevents arrive.

sequence-diagram

Prerequisites

Kubernetes Distro

This project provides scripts for setting up Knative using either of the following distros

Apple Mac OSX

  • Docker for Mac
  • Correctly configured Docker for Mac instance docker-for-mac
    • At least 3 CPUs
    • At least 5 GB of RAM
  • Kubernetes development tools
    brew install kubectl
    brew install kind
    brew install k3d
    brew install istioctl
    brew install helm

Linux

  • Docker
    yay docker
  • Kubernetes development tools
    yay kubectl
    yay kind
    yay rancher-k3d-bin
    yay istio
    yay helm

Getting started

Select Kubernetes Distro

  • Kind
    ./local/dev-kind
    
  • k3ds
    ./local/dev-k3ds
    

Examples

  1. Install example App

    kubectl apply -f ./examples/services.yaml
    ./examples/triggers
    kubectl wait ksvc node-service --for=condition=Ready
  2. Browser to the example Node Site http://node-service.default.127.0.0.1.nip.io/

  3. Post to example site

    curl -v "http://node-service.default.127.0.0.1.nip.io" -d '{}'
  4. Watch event triggered containers auto-scale

    kubectl get pods
    kubectl logs -l serving.knative.dev/service=rust-service -c user-container -f
    [2020-08-21T20:23:42Z INFO  rust_service] Starting rust-service
    [2020-08-21T20:23:42Z INFO  actix_server::builder] Starting 1 workers
    [2020-08-21T20:23:42Z INFO  actix_server::builder] Starting "actix-web-service-127.0.0.1:9000" service on 127.0.0.1:9000
    [2020-08-21T20:23:56Z INFO  rust_service] Event Data Example { sequence: 99, message: "hello from node-service - Handled by 0 - hello from go-service" }
  5. Inspect monitoring dashboard

    5.1 Start kubectl proxy

    kubectl port-forward --namespace knative-monitoring \
    $(kubectl get pods --namespace knative-monitoring \
    --selector=app=grafana --output=jsonpath="{.items..metadata.name}") \
    3000

    5.2 Browse to Grafana http://localhost:3000/

Performance Results from sample application

Node Service

node-service

Python Service

python-service

Golang Service

go-service

Rust service

rust-service

learn-knative's People

Contributors

andrewwebber avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

csantanapr

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.