VMware Event Broker on Kubernetes with Knative Functions – Part 2: Deployment and Configuration
In the first part of this series, we discussed the basics of VMware Event Broker and its integration with Knative functions on Kubernetes. In this second part, we will dive deeper into the deployment and configuration of the event broker and Knative functions. We will also explore some advanced features and use cases of the combination of VMware Event Broker and Knative functions.
Deploying VMware Event Broker on Kubernetes
—————————————–
To deploy VMware Event Broker on Kubernetes, we can use the Helm chart provided by the VEBA team. We will first need to register the Helm chart registry and get the metadata locally. The support of Knative with Helm VMware event router deployment method is only supported in chart version >= v0.6.2, so ensure that this version is available.
We can create a specific namespace for this purpose, such as `vmware-fn`, but we can also reuse the `vmware-fn` namespace or any other existing one. We will need to specify the broker name and namespace according to our configuration.
Here is an example of the `override.yaml` file we will use:
“`yaml
apiVersion: v1
kind: EventBroker
metadata:
name: vmware-event-broker
spec:
brokerName: vmware-event-broker
namespace: vmware-fn
“`
We can now deploy the Helm chart using the following command:
“`
helm install –name vmware-event-broker –namespace vmware-fn
https://vmware.github.io/knative-event-router/versions/main/helm/v0.6.2/vmware-event-broker.helm
“`
Once the deployment is complete, we can check the status of the deployment:
“`
kubectl get deployments
“`
We can also use the `kubectl describe` command to view more detailed information about the deployment:
“`
kubectl describe deployment vmware-event-broker
“`
Configuring Knative Functions
—————————-
To configure Knative functions, we will need to create a `function.yaml` file for each function we want to deploy. Here is an example of a `function.yaml` file for an echo function that will receive cloud events from the VMware Event Broker:
“`yaml
apiVersion: serving.knative.dev/v1alpha1
kind: Function
metadata:
name: kn-echo
spec:
handler: github.com/embano1/kn-echo/main.handler
eventTypes:
– cloud
labels:
app: kn-echo
“`
We can create the function by running the following command:
“`
kubectl apply -f function.yaml
“`
We can check the status of the function deployment:
“`
kubectl get functions
“`
Performing Tasks Based on Event Routing Setup
———————————————-
Now that we have deployed the VMware Event Broker and Knative functions, we can perform tasks based on the event routing setup. One useful task is to echo cloud events occurring in the target vCenter server. The VEBA team provides multiple echo samples (python or PowerShell-based), but we will use the python-based one provided by @embano1/kn-echo.
To check what was created, we can run the following command:
“`
kubectl get deployments
“`
We can also use the `kubectl describe` command to view more detailed information about the deployment:
“`
kubectl describe deployment kn-echo
“`
Autoscaling with Knative Serving
——————————-
One of the benefits of using Knative functions is the ability to autoscale based on incoming events. We can set the minimum and maximum scale settings using the `autoscaling` field in the `function.yaml` file. For example, here is an updated version of the `function.yaml` file with autoscaling settings:
“`yaml
apiVersion: serving.knative.dev/v1alpha1
kind: Function
metadata:
name: kn-echo
spec:
handler: github.com/embano1/kn-echo/main.handler
eventTypes:
– cloud
labels:
app: kn-echo
autoscaling:
minScale: 1
maxScale: 5
“`
In this example, the function will be scaled to a minimum of 1 instance and a maximum of 5 instances.
Advanced Features and Use Cases
——————————-
VMware Event Broker and Knative functions offer a wide range of advanced features and use cases, such as:
* Using the VMware Event Broker with other cloud providers, such as AWS or Azure.
* Integrating with other Kubernetes components, such as ConfigMaps or Secrets.
* Using Knative functions with other event sources, such as HTTP or gRPC.
* Implementing custom handlers for specific event types.
* Using the VMware Event Broker with other Knative functions, such as the `kn-http` function for receiving HTTP requests.
Conclusion
———-
In conclusion, VMware Event Broker and Knative functions offer a powerful combination for building cloud-native applications on Kubernetes. By integrating the VMware Event Broker with Knative functions, we can leverage the benefits of both technologies to build scalable, reliable, and secure applications that can respond to events in real-time.
We hope this series of blog posts has provided a comprehensive overview of the combination of VMware Event Broker and Knative functions on Kubernetes. Whether you are a cloud builder or a Kubernetes enthusiast, we encourage you to explore these technologies further and see how they can help you build the next generation of cloud-native applications.
Thank you for reading!