In an earlier post, we discussed how to install Apache OpenWhisk on a Kubernetes infrastructure. Now it’s time to get an OpenWhisk application deployed.

To do this, you’ll need OpenWhisk packages, which are sets of actions and feeds that are bundled together to easily share with others. IBM Cloud Functions, whose back-end is Apache OpenWhisk, has installed a list of shared packages for you to use. But if you are using your own Apache OpenWhisk cluster on Kubernetes, you need to install these packages before you can take advantage of them.

Apache Kafka is a distributed streaming platform. It can be used as a common message queue system. The Kafka package in OpenWhisk allows you to communicate with Kafka for publishing and consuming messages using the native high performance Kafka API. You’ll need it if you’re building a messaging-driven application. In order to deploy the Kafka package to your own OpenWhisk implementation, you can run the installation scripts manually with complicated configurations in several steps … or you can follow this post and use YAML files to deploy the Kafka package to Apache OpenWhisk on Kubernetes simply and easily.

The artifacts of a typical OpenWhisk package include two parts: a long running service, which has connections to an event source and monitors the changes of the event source, and the source code and installation scripts of actions and feeds in OpenWhisk.

Preparing YAML files

So, we need to complete the following steps to install a package:

  1. Build a docker image and run a docker container to provide a service.
  2. Install actions and feeds to your Apache OpenWhisk.

Correspondingly, in Kubernetes, we need to set up the following resources:

  1. A deployment and a service to provide the long running service.
  2. A job to execute the installation scripts.

We can use YAML files to describe these resources. I have prepared two such YAML files and saved them in a GitHub repository:

Deploying a Kafka package

Using these resources, you can deploy a Kafka package to your OpenWhisk on Kubernetes in three simple steps:

  1. Clone the Github repository to your local disk and go to folder kafka:
    $git clone
    $cd kafka
  2. Configure the environment values with the correct values in the kafkaprovider.yaml file and set up the long running service using:
    $kubectl apply -f kafkaprovider.yml
  3. Configure the environment values with the correct values in the kafkapkginstaller.yaml file and set up the job using:
    $kubectl apply -f kafkapkginstaller.yml
  4. You can now view actions and feeds:

    wsk package get /whisk.system/messaging --summary -i

    And that’s it! You’ve now successfully set up a Kafka package on top of your own Apache OpenWhisk implementation. If you want to install more useful packages to Apache OpenWhisk — for example, alarm — visit my OpenWhisk package repo to get more information. And I’d love to hear how you do with these instructions. You can leave me a comment below or in GitHub.

Join The Discussion

Your email address will not be published. Required fields are marked *