Deploy Apache OpenWhisk on Minishift
Problem
The following describes the process of deploying Apache OpenWhisk on Red Hat Container Development Kit using an installation of RHEL/CentOS.
Solution
-
Set Up the KVM Driver.
sudo /bin/bash -c '# Install Docker Machine v0.15.0 curl -L 'http://bit.ly/2CPLoyp' -o /usr/local/bin/docker-machine \ && chmod +x /usr/local/bin/docker-machine # Install Docker Machine KVM driver for Docker Machine curl -L 'http://bit.ly/2CU65sN' -o /usr/local/bin/docker-machine-driver-kvm \ && chmod +x /usr/local/bin/docker-machine-driver-kvm # Install libvirt and qemu-kvm on your system yum install libvirt qemu-kvm # Add yourself to the libvirt group usermod -a -G libvirt $USER # Start the libvirtd service systemctl start libvirtd systemctl enable libvirtd'
-
Install CDK (minishift).
-
Configure
minishift
with ample resources.minishift config set cpus 2 minishift config set memory 8GB
-
Configure components needed to run
minishift
.minishift setup-cdk
-
Start
minishift
.minishift start
-
Make the
oc
command available in your PATH.eval $(minishift oc-env)
-
Create a new project for OpenWhisk.
oc new-project openwhisk
-
Deploy OpenWhisk in your project using the latest ephemeral template.
TEMPLATE_PARAMS="INVOKER_MEMORY_REQUEST=512Mi INVOKER_MEMORY_LIMIT=512Mi INVOKER_JAVA_OPTS=-Xmx256m INVOKER_MAX_CONTAINERS=2 COUCHDB_MEMORY_REQUEST=256Mi COUCHDB_MEMORY_LIMIT=256Mi" \ && oc process -f https://git.io/openwhisk-template $TEMPLATE_PARAMS | oc create -f -
-
Install OpenWhisk CLI (wsk).
sudo /bin/bash -c 'curl -L 'http://bit.ly/2Fl0Pl0' | tar -xvzf - -C /bin wsk &>/dev/null'
-
Config
wsk
CLI AuthenticationAUTH_SECRET=$(oc get secret whisk.auth -o yaml | grep "system:" | awk '{print $2}' | base64 --decode) \ && wsk property set --auth $AUTH_SECRET --apihost $(oc get route/openwhisk -o jsonpath='https://{.spec.host}')
-
Optionally, install Whisk Deploy (wskdeploy) to help deploy and manage all your OpenWhisk Packages, Actions, APIs, Triggers and Rules using a single command.
sudo /bin/bash -c 'curl -L 'http://bit.ly/2CWlidd' | tar -xvzf - -C /bin wskdeploy &>/dev/null'
-
Verify your OpenWhisk environment.
wsk --insecure list wsk --insecure action invoke /whisk.system/utils/echo --param message hello --blocking
Note that the
--insecure
option avoids the validation error triggered by the self-signed cert in the nginx service. -
Check out Getting started with OpenWhisk.
Summary
OpenWhisk is largely credited to IBM for seeding. It is an open source implementation of a cloud-first distributed event-based programming service that allows calling of a specific function in response to an event without requiring any resource management from the developer.
Click here to see a curated list of awesome OpenWhisk things!