Knative

The instructions below will be focus on deploying the Knative serving components. Once you have that setup, it is easy to deploy the eventing components which you can follow the official Knative documentation.

Install

Knative Serving on vSphere with Tanzu

I will assume that you already have deployed a vSphere with Tanzu environment using either HAProxy or NSX-T for your Load Balancer. You will also noticed below there are additional pod security policies (PSP) YAML files which must be configured prior to allowing our workloads to run, this is by design to ensure that no rogue workloads are simply scheduled.

Step 1 - Deploy the Knative serving components by running the following:

kubectl apply -f https://github.com/knative/serving/releases/download/v0.21.0/serving-crds.yaml
kubectl apply -f https://github.com/knative/serving/releases/download/v0.21.0/serving-core.yaml
kubectl apply -f https://raw.githubusercontent.com/lamw/knative-on-tkg/master/vsphere-with-tanzu/knative-serving-psp.yaml

Step 2 - The deployment will take a few minutes, you can watch the following command until all components show ready before proceeding to the next step.

kubectl -n knative-serving get deployments

Step 3 - For the networking layer, we are going to use Kourier instead of Istio. Run the following command to deploy and configure Knative:

kubectl apply -f https://github.com/knative-sandbox/net-kourier/releases/download/v0.21.0/kourier.yaml
kubectl patch configmap/config-network --namespace knative-serving --type merge --patch '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}'
kubectl apply -f https://raw.githubusercontent.com/lamw/knative-on-tkg/master/vsphere-with-tanzu/kourier-system-psp.yaml

Step 4 - The deployment will take a few minutes, you can watch the following command until all components show ready before proceeding to the next step.

kubectl -n kourier-system get deployments

Step 5 - The deployment will take a few minutes, you can watch the following command until all components show ready before proceeding to the next step.

kubectl -n kourier-system get svc kourier

In the example above, the IP Address is 192.168.15.132, record this as you will need it for the next step.

Step 6 - Take the LB IP Address from the previous step and run the following command to configure Knative serving:

kubectl patch configmap/config-domain --namespace knative-serving --type merge --patch '{"data":{"192.168.15.132.nip.io":""}}'

Step 7 - To verify that Knative serving has been deployed correctly, we will deploy their sample hello world application. Run the following command to deploy the new service:

kubectl apply -f https://raw.githubusercontent.com/lamw/knative-on-tkg/master/vsphere-with-tanzu/service.yaml
kubectl apply -f https://raw.githubusercontent.com/lamw/knative-on-tkg/master/vsphere-with-tanzu/helloworld-go-psp.yaml

Step 8 - The deployment will take a minute or so, watch the following command until the Ready status shows true.

kubectl get ksvc -n default

Step 9 - Using the previous command, retrieve the URL and perform a cURL and if everything was setup correctly, you should receive a response like on shown below:

curl http://helloworld-go.default.192.168.15.132.nip.io

To remove the sample app from your cluster, delete the service record:

kn service delete helloworld-go

Knative Eventing

Step 1 - Deploy the Knative serving components by running the following:

kubectl apply -f https://github.com/knative/eventing/releases/download/v0.21.0/eventing-crds.yaml
kubectl apply -f https://github.com/knative/eventing/releases/download/v0.21.0/eventing-core.yaml
kubectl apply -f https://github.com/knative/eventing/releases/download/v0.21.0/in-memory-channel.yaml
kubectl apply -f https://github.com/knative/eventing/releases/download/v0.21.0/mt-channel-broker.yaml

Step 2 - The deployment will take a few minutes, you can watch the following command until all components show ready before proceeding to the next step.

kubectl get pods --namespace knative-eventing

References


This project is for educational and home lab purposes.