unfor19 / knative-example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

knative-example

Requirements

Getting Started

  1. Start Kubernetes cluster locally with minikube

    kn quickstart minikube --kubernetes-version 1.27
  2. Start a separated terminal for a tunnel

    minikube tunnel --profile knative
  3. Create function

    kn-func create -l node knative-example
  4. Install dependencies locally

    npm install
  5. Run the function

    cd knative-example && kn-func run --registry docker.io/unfor19
  6. Test the function

    cd knative-example && npm test
  7. Rebuild the function Docker image

    cd knative-example && kn-func build --registry docker.io/unfor19
  8. Push the function to the Kubernetes cluster

    cd knative-example && kn-func deploy --build --registry docker.io/unfor19
  9. Create the function as a service for the first time

    kn service create knative-example \
     --image docker.io/unfor19/knative-example:latest \
     --port 8080 \
     --env TARGET=initial-value
  10. Test the deployed service http://knative-example.default.127.0.0.1.sslip.io?hello=world

    cd knative-example && npm test
    
    curl -L http://knative-example.default.127.0.0.1.sslip.io?hello=world
    
  11. Update the service

    kn service update knative-example \
     --image docker.io/unfor19/knative-example:latest \
     --port 8080 \
     --env TARGET=updated

About


Languages

Language:JavaScript 100.0%