Contents


Run your business decisions in Kubernetes with IBM Bluemix

Comments

You might wonder how to combine the strengths of enterprise-grade decision management with a cloud microservice architecture. Is it possible to author, test, and operate decision services in a container platform on the cloud and benefit from open source technologies?

This tutorial shows how to deploy IBM® Operational Decision Manager (ODM) Standard in a Kubernetes cluster on IBM Bluemix. You learn how you start with Docker images and then reach a running, clustered IBM ODM platform with Kubernetes.

IBM ODM is a decision platform to automate your business policies. Business users and developers can shape a decision model, automating a decision logic on a business vocabulary and running it as a web decision service. IBM ODM consists of two main components, IBM Decision Center and IBM Decision Server. They form the platform for managing and running business rules to help your organization make decisions faster and improve responsiveness. Your business rules, written in English, Chinese, or another supported language, are packaged into decision services and exposed as web services (including REST/JavaScript Object Notation style).

This tutorial extends information in Deploy an IBM Operational Decision Manager topology with Docker Compose, which focuses on building IBM ODM Docker images. Kubernetes and Docker Compose are two alternate ways to assemble containers from the same Docker images.

In this tutorial, learn how to use the IBM ODM Docker files to build images articulated on IBM WebSphere Application Server Liberty with a Derby database. You push the IBM ODM Docker images to Bluemix, and you use the Kubernetes Cluster app to instantiate them in a Kubernetes cluster that is hosted in the cloud.

Tutorial step flow                     illustration
Tutorial step flow illustration

By running IBM ODM runtime environments in a Kubernetes cluster on Bluemix, you empower your decision application business users to write and quickly test and deploy decision services in the cloud. This approach improves availability and scalability of your platform with operational IT features of Kubernetes.

What you need to build your application

Make sure you have the following tools and environment:

  • An installation of IBM ODM Standard V8.9.0 or V8.8.x on your local machine.
  • An IBM Bluemix account. If you do not have an existing Bluemix account, start your free trial.
  • IBM ODM Docker images built on your local machine.

Complete the following set-up steps:

1

Push your IBM ODM Docker images to Bluemix

In this section you promote the IBM ODM Docker images on your local machine to Bluemix.

  1. Log in to your Bluemix account:
    bx login -a https://api.ng.bluemix.net

    If you have a federated ID, use bx login --sso to log in to the Bluemix command-line interface.

  2. Install the IBM Bluemix Container Registry plug-in:
    	bx plugin install container-registry -r bluemix
  3. After the plugin is installed, you can log into the Bluemix Container Registry:
    	bx cr login
  4. If this is the first time you use the Bluemix Container Registry, you must set a namespace that identifies your private Bluemix images registry. It can be between 4 and 30 characters:
    	bx cr namespace-add namespace

    For example in the examples shown in screenshots, the registry namespace is odmlab.

  5. Build your IBM ODM images.

    In the odm-ondocker folder, run the following command:

    docker-compose build
    docker images

    You now see the following IBM ODM images in your local Docker registry.

    Screen capture of                     IBM ODM images in a local Docker registry
    Screen capture of IBM ODM images in a local Docker registry
  6. Tag and push the following IBM ODM images:
    • DBServer
      	docker tag odmdocker/dbserver:8.9.0 registry.ng.bluemix.net/odmlab/ibm-odm-dbserver:8.9.0
      	docker push registry.ng.bluemix.net/odmlab/ibm-odm-dbserver:8.9.0
    • HTDS
      	docker tag odmdocker/decisionserverruntime:8.9.0 registry.ng.bluemix.net/odmlab/ibm-odm-decisionserverruntime:8.9.0
      	docker push registry.ng.bluemix.net/odmlab/ibm-odm-decisionserverruntime:8.9.0
    • Decision Center
      	docker tag odmdocker/decisioncenter:8.9.0 registry.ng.bluemix.net/odmlab/ibm-odm-decisioncenter:8.9.0
      	docker push registry.ng.bluemix.net/odmlab/ibm-odm-decisioncenter:8.9.0
    • Decision Server Console
      	docker tag odmdocker/decisionserverconsole:8.9.0 registry.ng.bluemix.net/odmlab/ibm-odm-decisionserverconsole:8.9.0
      	docker push registry.ng.bluemix.net/odmlab/ibm-odm-decisionserverconsole:8.9.0
    • DecisionRunner
      	docker tag odmdocker/decisionrunner:8.9.0 registry.ng.bluemix.net/odmlab/ibm-odm-decisionrunner:8.9.0
      	docker push registry.ng.bluemix.net/odmlab/ibm-odm-decisionrunner:8.9.0
  7. Verify that you have the following IBM ODM images present in your Bluemix Container Registry: Screen capture of                     IBM ODM images in a Bluemix Container Registry
    Screen capture of IBM ODM images in a Bluemix Container Registry

Your IBM ODM images are now ready to be instantiated in Bluemix.

2

Create a Kubernetes cluster in Bluemix

To create a lite cluster in Bluemix, complete the following steps:

  1. In the Bluemix catalog, under Apps, click Containers and select Kubernetes Cluster.
  2. Enter the cluster details. The default cluster type is lite, so you need to customize only a few values.
    1. Enter a cluster name.
    2. Select a location where you deploy your cluster. The locations that are available to you depend on the region associated with your Bluemix account.
  3. Click Create Cluster. The details for the cluster open, but the worker node in the cluster takes a few minutes to provision. You can see the status of the worker node in the Worker nodes tab. When the status is listed as Ready, you can use the worker node.

You have now your Kubernetes cluster ready for the steps in the tutorial. Note that a lite cluster is dedicated to easy access for the tutorial and has a single node. For an enterprise use, create a standard cluster. In both cases, the IBM ODM Docker images remain unchanged.

Now complete the following steps to finish setting up the Kubernetes cluster in Bluemix:

  1. Initialize the Bluemix Container Service plug-in:
    bx cs init
  2. Set your terminal context to your cluster:
    bx cs cluster-config ODMCluster
    In the output, the path to your configuration file is displayed as a command to set an environment variable, for example:
    export KUBECONFIG=/Users/ibm/.bluemix/plugins/container-service/clusters/ODMCluster/kube-config-prod-hou02-ODMCluster.yml
  3. Copy and paste the command to set the environment variable in your terminal and press ENTER.
    You can also directly download your kubeconfig files to manually configure context.

You're all set. You can verify your worker nodes by running the following Kubernetes commands:

kubectl get nodes

You can also access your Kubernetes dashboard with the following command:

kubectl proxy

Use http://127.0.0.1:8001/ui to view your Kubernetes dashboard, which looks like the follow screen capture:

Screen capture of                     Kubernetes proxy when started
Screen capture of Kubernetes proxy when started
3

Provision an IBM ODM decision platform in the Kubernetes Container on Bluemix

An IBM ODM topology is defined based on Kubernetes pod, service, and deployment abstractions.

For each IBM ODM module see the sample YAML descriptor file, which specifies the following information:

  • A pod, with the list of Docker containers you instantiate from the image in the Docker registry
  • A service, which selects the pods where you declare an external endpoint for connectivity
  • A deployment

For example, review the following sample code for the IBM ODM Decision Server runtime environment (hosted transparent decision service):

apiVersion: extensions/v1beta1 # for versions before 1.6.0 use extensions/v1beta1
kind: Deployment
metadata:
  name: odm-decisionserverruntime
spec:
  replicas: 2
  template:
    metadata:
      labels:
        run: odm-decisionserverruntime
    spec:
      containers:
      - name: odm-decisionserverruntime
        image: registry.ng.bluemix.net/odmlab/ibm-odm-decisionserverruntime:8.9.0
        ports:
        - containerPort: 9080
---
apiVersion: v1
kind: Service
metadata:
  name: odm-decisionserverruntime
  labels:
    run: odm-decisionserverruntime
spec:
  selector:
    run: odm-decisionserverruntime
  type: NodePort
  ports:
   - protocol: TCP
     port: 9080

The first part is the deployment, defined by kind: Deployment, and it is sized to 2 pods, which is designated by the replica value. The Docker image is registry.ng.bluemix.net/odmlab/ibm-odm-decisionserverruntime:8.9.0. The internal port is defined by containerPort: 9080.

The second part of the code sample is the service, which is defined by kind: Service. The connectivity type is defined by type: NodePort, and the external port is defined by port: 9080. This service keeps the same port number, but other services like the DecisionCenter map their internal HTTP ports to a new external port (avoiding collisions when running in the same host).

All these descriptor pieces are assembled in two YAML files on Github:

Get and run the Kubernetes descriptor:

  1. Clone the Kubernetes descriptor file to your local directory:
    git clone https://github.com/PierreFeillet/IBM-ODM-Kubernetes.git
    cd IBM-ODM-Kubernetes/Bluemix
  2. Run the following command:
    • If you are using a lite cluster, use this command:
      kubectl create –f odm-standard-bx-lite.yaml
    • If you are using a standard cluster, use this command:
      kubectl create –f odm-standard-bx-standard.yaml

You should see the deployments, services, and pods, as shown in the following screen captures.

Screen capture of                     IBM ODM deployments
Screen capture of IBM ODM deployments
Screen capture of                     IBM ODM services
Screen capture of IBM ODM services
Screen capture of                     IBM ODM pods
Screen capture of IBM ODM pods
4

Access Decision Center and Decision Server hosted in your Kubernetes cluster

Now set up access to Decision Center and Decision Server, running as Docker containers in Bluemix. IBM ODM deployment in a lite Kubernetes cluster on Bluemix relies on a NodePort configuration. All declared services to reach the authoring and execution end points are based on the host IP address and mapped port number. For a standard cluster decisioncenter and server services leverage a LoadBalancer connectivity.

  1. Run the following command:
    kubectl get nodes.
    Note the node IP adress as <host>. In this example, the node IP address is YYY.

    You see a result like the following screen capture:

    Screen capture of                     results of kubect1 get nodes command
    Screen capture of results of kubect1 get nodes command
  2. Run the following command:
    kubectl get services

    Note that connecting to containers requires few minutes to reach the HTTP endoints. Then you see a result like the following screen capture:

    Screen capture of results of kubectl get services command
    Screen capture of results of kubectl get services command
  3. Note the mapped port for the services that you want to reach. For example, the Decision Center responds on XXX port.

See the following list of URL credentials:

Component URL User name and password
Decision Center http://<host>:<mappedport>/decisioncenter/t/libraryrtsAdmin / rtsAdmin
Decision Server console http://<host>:<mappedport>/resresAdmin / resAdmin
Decision Server running service http://<host>:<mappedport>/DecisionService/ No user name or password required.
Decision Runner application http://<host>:<mappedport>/DecisionRunner/ No user name or password required.
5

Scale out the decision platform

With Kubernetes, you can easily scale out containers running in a pod. For example, you might want to add two containers to the two containers that are already running for the decision service runtime.

Run the command, as shown in the following screen capture:

Screen capture of                     Kubernetes command to add two containers
Screen capture of Kubernetes command to add two containers

Check that you now have four odm-decisionserviceruntime pods in the cluster, as shown in the following screen capture:

Screen capture of pods after scale out
Screen capture of pods after scale out

Another benefit of using Kubernetes is self-healing. For IBM ODM all containers, including the Rule Execution Server Console (running as odm-decisionserverconsole) are automatically restarted. A console that is down is restarted in few seconds and ready to accept new decision service deployments. Then the switch of console containers is totally transparent for decision execution containers.

Finally you can easily unprovision your IBM ODM topology by running the following command:

  • If you are using a lite cluster, use this command:
    kubectl delete –f odm-standard-bx-lite.yaml
  • If you are using a standard cluster, use this command:
    kubectl delete –f odm-standard-bx-standard.yaml

Conclusion

You learned how to promote your IBM ODM Docker images in Bluemix and provision an IBM ODM Standard platform composed of containers running in a Kubernetes cluster.

By combining Docker and Kubernetes, you have the power to deploy your IBM ODM platform both on premises and on any cloud platform that supports these industry standards. This approach empowers your business users and development team to govern and automate at scale with your enterprise decisions.

Kubernetes complements Docker container technology by adding cluster power to deliver a full-featured IBM ODM platform for capturing, automating, and governing frequent, repeatable business decisions. This combination empowers business users to define and deploy their decision services while Kubernetes and Docker bring DevOps agility to IT teams.

Bluemix delivers the Kubernetes Cluster as a service, available with just a few clicks and commands. You can start with a Kubernetes lite cluster to test an IBM ODM deployment. However, a standard cluster is the preferred configuration for a multiple node cluster, to get full availability and scalability advantages.

Note that IBM licensing requires installing auditing tools on the cluster nodes. For questions, contact Antony Viaud at antony.viaud@fr.ibm.com.

Now that you understand the concepts in this tutorial, you can tailor IBM ODM Docker files more specifically to your needs and integration environment, starting with the database and security. To optimize resource allocations and contain your migration costs, use the Kubernetes auto-scaling and rolling update capabilities.

Running a full IBM ODM rule platform in Bluemix empowers you to innovate by combining rules-based decision management with any of the cloud capabilities. For example, you might include Watson conversation and other cognitive services to invent next-generation artificial intelligent enterprise applications.

Acknowledgements

The authors would like to thank Antony Viaud for reviewing this tutorial.


Downloadable resources


Related topics


Comments

Sign in or register to add and subscribe to comments.

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Middleware, Cloud computing
ArticleID=1046634
ArticleTitle=Run your business decisions in Kubernetes with IBM Bluemix
publish-date=06142017