Skip to content

This repository contains resources for knative demo prepared for SUSE HackWeek18.

Notifications You must be signed in to change notification settings

bikramnehra/knative-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

knative-demo

This repository contains resources for knative demo prepared for SUSE HackWeek18.

alt text

Install

Install knative on minikube by following instructions here or install.txt.

Build

Create a BuildTemplate for Cloudfoundry buildpacks:

kubectl apply -f build/cf.yaml

Create a Secret to store docker credentials:

kubectl create secret generic regcred \
    --from-file=.dockerconfigjson=/path/to/.docker/config.json \
    --type=kubernetes.io/dockerconfigjson

Create a ServiceAccount using the above Secret:

kubectl apply -f build/sa.yaml

Create a BuildTemplate by replacing git url(with your app) and docker repo in build/build.yaml and run:

kubectl apply -f build/build.yaml

Serving

Deploy a service using the generated container image in the build step:

kubectl apply -f serve/service.yaml

Check the created service/revision by running:

kubectl get kservice
kubectl get revisions

Find the IP/NodePort of the service by running:

INGRESSGATEWAY=istio-ingressgateway && \
IP_ADDRESS=$(minikube ip):$(kubectl get svc $INGRESSGATEWAY --namespace istio-system --output 'jsonpath={.spec.ports[?(@.port==80)].nodePort}')

To check if service is up and running:

curl -H "Host: knative-demo-app.default.example.com" ${IP_ADDRESS}

Autoscaling

The default autoscaling in Knative kpa.autoscaling.knative.dev is based on concurrency. It can be tweaked and customized though, in this demo we used following annotations:

# Knative concurrency-based autoscaling (default).
autoscaling.knative.dev/class: kpa.autoscaling.knative.dev
autoscaling.knative.dev/metric: concurrency
# Target 10 requests in-flight per pod.
autoscaling.knative.dev/target: "10"
# Disable scale to zero with a minScale of 1.
autoscaling.knative.dev/minScale: "1"
# Limit scaling to max pods.
autoscaling.knative.dev/maxScale: "3"

For using the Standard Kubernetes CPU-based autoscaling:

autoscaling.knative.dev/class: hpa.autoscaling.knative.dev
autoscaling.knative.dev/metric: cpu 

For load testing:

hey -z 30s -c 50 \
  -host "knative-demo-app.default.example.com" \
  "http://${IP_ADDRESS}"

Grafana

Use following command to port foward and access Grafana Dashboards:

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

Eventing

Follow instructions here: https://knative.dev/docs/eventing/samples/github-source/

Currently blocked on: knative/eventing-contrib#475

Links:

About

This repository contains resources for knative demo prepared for SUSE HackWeek18.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published