Installing Knative with Istio on minikube for Windows

Installing Knative

Let’s give this a try. Don’t worry, you can always cleanly remove anything that’s been added here. I have Uninstall instructions at the end of this post.

Install Knative in your Istio-enabled minikube

Since we already have Istio installed, we decided to choose the installation method catered to this type of environment. We will be installing Knative files sourced from their official Github repos.

kubectl apply --filename https://github.com/knative/serving/releases/download/v0.16.0/serving-crds.yamlkubectl apply --filename https://github.com/knative/serving/releases/download/v0.16.0/serving-core.yamlkubectl apply --filename https://github.com/knative/net-istio/releases/download/v0.16.0/release.yamlkubectl apply --filename https://github.com/knative/eventing/releases/download/v0.16.0/eventing-crds.yamlkubectl apply --filename https://github.com/knative/eventing/releases/download/v0.16.0/eventing-core.yamlkubectl apply --filename https://github.com/knative/eventing/releases/download/v0.16.0/in-memory-channel.yaml
A portion of the output from installing Knative-Eventing

Check on the installation

See if the Knative pods are running. It will take a few minutes depending on how many resources you have dedicated.

kubectl get pods --namespace knative-serving
kubectl get pods --namespace knative-eventing

Deploy a sample Serving serverless app

The following assumes you have a namespace called airwave-deploy . Once your Knative pods are running, it will be time to install a serverless app. This will utilize the Serving component of Knative. We will cover the Eventing component in a future post.

kubectl create namespace airwave-deploy
kubectl label namespace airwave-deploy istio-injection=enabled
kubectl apply --filename https://raw.githubusercontent.com/airwavetechio/hello-world/master/knative-service.yml
installing the airwavetech hello-world serverless example

Testing it out

Now that our serverless app is deployed, how do we access it? The following will show you how.

Get the IP and Port information

Imagine istio-ingressgateway as the one and only load balancer of our one-node cluster. Because minikube is a one-node cluster with a private IP assigned to it, you can presume that the load balancer of our single node cluster would be the same IP as the machine it was running on. It just so happens it is, and it listens on a certain TCP port. We need to find out what those are.

minikube ip && kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name==\"http2\")].nodePort}'

Get the Host header information

With the default settings, Knative will generate an accessible URL for your service, hence the example.com domain name. The naming convention can be customized to your liking, along with other settings, but that’s beyond the scope of what we are trying to do.

kubectl get ksvc airwavetech-helloworld -n airwave-deploy --output=custom-columns=NAME:.metadata.name,URL:.status.url
Capture the URL
curl -H "Host: <your URL without http://>" http://<minikube IP>:<istio-ingressgatway PORT> 
or
curl -H "Host: airwavetech-helloworld.airwave-deploy.example.com" http://192.168.79.129:30827 -v -i
curl the website using the proper host header

Follow up

What just happened?

How did applying knative-service.yml get a service deployment out and routable?

a screengrab from Kiali showing how things are connected
This file looks like a mix up between your service definition and deployment.

Auto-Scale

As you check on your pods and look around, you might notice terminating pods.

kubectl get pods --namespace airwave-deploy
screengrab of various commands
screengrab of on-demand auto-scaling

Uninstalling Knative

If you want to roll back everything we have just done, just run the following commands:

kubectl delete --filename   https://raw.githubusercontent.com/airwavetechio/hello-world/master/knative-service.ymlkubectl delete namespace airwave-deploykubectl delete --filename https://github.com/knative/eventing/releases/download/v0.16.0/in-memory-channel.yamlkubectl delete --filename https://github.com/knative/eventing/releases/download/v0.16.0/eventing-core.yamlkubectl delete --filename https://github.com/knative/eventing/releases/download/v0.16.0/eventing-crds.yamlkubectl delete --filename https://github.com/knative/net-istio/releases/download/v0.16.0/release.yamlkubectl delete --filename https://github.com/knative/serving/releases/download/v0.16.0/serving-core.yamlkubectl delete --filename https://github.com/knative/serving/releases/download/v0.16.0/serving-crds.yaml

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store