TIBCO on Kubernetes: How to instantiate and start a TIBCO BusinessWorks Container Edition (BWCE) application Docker Image on Kubernetes (Minikube)?

In the last blogpost I created, instantiated and started a TIBCO BusinessWorks Container Edition (BWCE) application docker image using a local Docker daemon. In this blogpost we will be instantiating and starting the TIBCO BWCE application Docker image on a local Kubernetes cluster (Minikube)!

Kubernetes

What is Kubernetes?
Kubernetes (also K8s) is an open-source system for automating deployment, scaling, and management of containerized applications. It was originally created by Google (everything Google creates is of course awesome!) and “Kubernetes” is Greek and stands for “helmsman” or “pilot”.

What is Minikube?
Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single-node Kubernetes cluster inside a VM (for example VirtualBox) on your laptop or Mac for users looking to try out Kubernetes or develop with it day-to-day.

In this blogpost I won’t be focussing on the installation of the local Kubernetes cluster via Minikube. There is a very easy walkthrough tutorial available on the website of Kubernetes (see link below).

https://kubernetes.io/docs/getting-started-guides/minikube/

After installing Minikube we can fire it up by running “minikube start”. We can also choose to start-up the dashboard that come out-of-the-box by running “minikube dashboard”.

1. First we need to understand that Minikube comes with it’s own Docker daemon pre-installed, in this blogpost I chose to use this Docker daemon to avoid any security hassle with the Docker registry. By running the following “eval” command I can use Docker from the command line on my MacBook Pro while talking to the Docker daemon in the Minikube VM:

MacBook-Pro: ruben.middeljans$ eval $(minikube docker-env)

2. Now we need to create and tag the TIBCO BWCE Base Docker Image in the Minikube VM’s Docker Registry (like we did in my last blogpost). For this navigate to <TIBCO_HOME>/bwce/<version>/docker and run the following command:

MacBook-Pro:docker ruben.middeljans$ docker build -t tibco/bwce:latest .

3. The TIBCO BWCE Base Docker Image has now been created and tagged as “tibco/bwce:latest” in the Minikube VM’s Docker registry. Verify the creation by running the following command:

MacBook-Pro:docker ruben.middeljans$ docker images

4. Now we need to create and tag the Docker application image for our TIBCO BWCE application (helloWorld_1.0.0.ear) in the Minikube VM’s Docker registry. Notice that we tag the Docker image with “v1” and not “latest”! Otherwise, if you do not specify a version of your image, it will be assumed as “latest”, with pull image policy of “always” correspondingly, which may eventually result in “ErrImagePull” as you may not have any versions of your Docker image out there in the default docker registry (usually DockerHub) yet.

MacBook-Pro: ruben.middeljans$ docker build -t helloworldbwce:v1 .

5. Run the following command to create a Kubernetes Deployment object*.

MacBook-Pro: ruben.middeljans$ kubectl run helloworldbwce-node --image=helloworldbwce:v1 --port=8080
deployment "helloworldbwce-node" created

*”A Kubernetes Pod is a group of one or more Containers, tied together for the purposes of administration and networking. A Kubernetes Deployment checks on the health of your Pod and restarts the Pod’s Container if it terminates. Deployments are the recommended way to manage the creation and scaling of Pods.

6. Run the following command to view the Kubernetes Deployment object:

MacBook-Pro: ruben.middeljans$ kubectl get deployments
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
helloworldbwce-node 1 1 1 1 12s

7. Run the following command to view the Kubernetes Pod that was created by the Deployment Object:

MacBook-Pro: ruben.middeljans$ kubectl get pods
NAME READY STATUS RESTARTS AGE
helloworldbwce-node-2301106929-hprg4 1/1 Running 0 21s

9. Create a service* to expose the Kubernetes Pod the the public internet.

MacBook-Pro: ruben.middeljans$ kubectl expose deployment helloworldbwce-node --type=LoadBalancer
service "helloworldbwce-node" exposed

*”By default, the Pod is only accessible by its internal IP address within the Kubernetes cluster. To make the “helloworldbwce-node” container accessible from outside the Kubernetes virtual network, you have to expose the Pod as a Kubernetes Service.”

10. Verify the creation of the service we just created by running the following command:

MacBook-Pro: ruben.middeljans$ kubectl get services
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
helloworldbwce-node 10.0.0.113 <pending> 8080:30724/TCP 12s
kubernetes 10.0.0.1 <none> 443/TCP 1d

Notice that internal port 8080 has been mapped to external port 30724.

“The –type=LoadBalancer flag indicates that you want to expose your service outside of the cluster. On cloud providers that support load balancers, an external IP address would be provisioned to access the service. On Minikube, the LoadBalancer type makes the service accessible through the minikube service command.”

11. Run the following command to retrieve the public ip-address and port of the “helloworldbwce-node” container.

MacBook-Pro: ruben.middeljans$ minikube service --url helloworldbwce-node
http://192.168.99.100:30724

12. Since the helloworld application contains a RESTful API we can fire up a browser and head to the Swagger UI (which TIBCO BW6 and BWCE generates by default for each RESTful API, awesome!).

http://192.168.99.100:30724/swagger

1

13. And last but no least, we can open up the Kubernetes dashboard and verify the running “helloworldbwce-node” container. From this dashboard we can do all kind of administrative tasks like from example scaling Kubernetes Pods.

2

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: