Running RMS Applications in Kubernetes
To use TIBCO BusinessEvents® WebStudio in Kubernetes cluster, you must setup TIBCO BusinessEvents and Rule Management Server (RMS) in AWS based Kubernetes.
Procedure
- Set up a Kubernetes cluster on Amazon Web Services (AWS). For more information, see Setting up a Kubernetes Cluster on AWS.
-
In AWS, create an EFS file system.
For more information on the steps to create an EFS file system, see Amazon EFS documentation at https://docs.aws.amazon.com/efs/latest/ug/gs-step-two-create-efs-resources.html. Specify the Kubernetes cluster Virtual Private Cloud (VPC) and Security Group while creating a mount target for the file system. On the File Systems page, verify that the mount target shows the Life Cycle State as Available. Under File system access, you see the file system DNS name. Make a note of this DNS name.After successful creation of the EFS file system, note its File System ID, which can be used for creating EFS provisioner.
-
Create the EFS provisioner and other associated resources. Specify all the connection setup values for the EFS file system in a
manifest.yaml file and run the
kubectl command to create the EFS provisioner.
- Download the sample manifest.yaml file from https://raw.githubusercontent.com/kubernetes-incubator/external-storage/master/aws/efs/deploy/manifest.yaml and edit it according to your setup.
- In the configmap section specify File System ID of the newly created EFS as the value of the file.system.id: variable and Availability Zone of the newly created EFS as the value of the aws.region: variables.
- In the Deployment section, specify DNS name of the newly created EFS as the value of the server: variable.
-
Run the
kubectl command to apply the settings in
manifest.yaml.
kubectl apply -f manifest.yaml
-
Ensure that the EFS provisioner pod is in the running state using the
kubectl command.
kubectl get pods
-
As RMS is running in a Docker container, separate external storage needs to be setup for required files and artifacts. For this, create EFS based
PersistentVolumeClaim (PVC) using the configuration files (YAML format). The following sample YAML files for creating PVCs are located at
BE_HOME\cloud\kubernetes\rms:
Sample Kubernetes YAML Files for Creating PVCs File Name PVC Name Description efs-project-pvc.yaml efs-webstudio Setup the PVC for storing BusinessEvents project files. efs-ac-pvc.yaml efs-security Setup the PVC for storing BusinessEvents project ACL files, such as, CreditCardApplication.ac. efs-shared-pvc.yaml efs-shared Setup the PVC for storing RMS artifacts after hot deployment, such as, rule template instances. efs-notify-pvc.yaml efs-notify Setup the PVC for storing Email notification files, such as, message.stg. -
Run the
create command of
kubectl utility using the YAML files to create PVCs on the EFS file system.
For example, create PVCs using the sample files:
kubectl create -f efs-project-pvc.yaml kubectl create -f efs-ac-pvc.yaml kubectl create -f efs-shared-pvc.yaml kubectl create -f efs-notify-pvc.yaml
-
Mount the EFS file system into the Kubernetes EC2 instance nodes.
For more information on how to mount EFS file system on EC2 instance, refer AWS Documentation at https://docs.aws.amazon.com/efs/latest/ug/mounting-fs.html.After successful mounting, PVCs on EFS are available for uploading files.
-
Transfer files from your system to the respective PVCs.
- RMS project files (for example, project files at BE_HOME\examples\standard\WebStudio\) to the project storage PVC (efs-webstudio)
- RMS security files and project access control (.ac) files at BE_HOME\rms\config\security to the security storage PVC (efs-security).
- RMS notification related files (for example, message.stg at BE_HOME\rms\config\notify) to the notify storage PVC (efs-notify).
For information on how to transfer files from your system to EC2 instance, refer to the Amazon AWS Documentation at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html.
-
Define an internal JMX Kubernetes service using the supplied sample YAML configuration file
bejmx-service.yaml.
RMS server use this service to connect to the JMX port of a BusinessEvents pod.
kind: Service apiVersion: v1 metadata: name: bejmx-service spec: selector: dep_name: beinference-label ports: - protocol: TCP port: 5555 targetPort: 5555
-
Build the RMS Docker image for deploying to Kubernetes.
For every project add JMX configuration in RMS.cdd, for example:
<property name="ProjectName.ws.applicableEnvironments" type="string" value="QA,PROD"/> <property name="ProjectName.QA.ws.jmx.hotDeploy.enable" type="boolean" value="true"/> <property name="ProjectName.QA.ws.jmx.host" type="string" value="bejmx-service.default.svc.cluster.local"/> <property name="ProjectName.QA.ws.jmx.port" type="integer" value="5555"/> <property name="ProjectName.QA.ws.jmx.user" type="string" value=""/> <property name="ProjectName.QA.ws.jmx.password" type="string" value=""/> <property name="ProjectName.QA.ws.jmx.clusterName" value="CreditCardApplication"/> <property name="ProjectName.QA.ws.jmx.agentName" value="inference-class"/>
For every project configure jmx.host as the fully qualified name (FQN) of the local JMX Kubernetes service defined earlier, for example, bejmx-service.default.svc.cluster.local. Also, for every project configure jmx.port as the JMX port number defined in the JMX Kubernetes service, for example, 5555.
- Create RMS Docker image. For more information, see Running BusinessEvents Rule Management Server (RMS) in Docker.
-
Go to the EC2 Container Services dashboard and create a repository with the same name as the RMS Docker image. Upload the RMS image to the repository. You may use the
View Push Commands button to view how to do that.
For more information on how to create a repository in Amazon AWS, refer to https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-create.html.
-
Create Kubernetes resources, required for deploying BusinessEvents cluster, using the YAML files.
These resources include deployment and services for the cluster. Thus, to deploy a BusinessEvents cluster, create:
- a discovery node (pod) to start the cluster.
- a service to connect to discovery node.
- a cache agent node that connects to the discovery node service.
- an inference agent node that connects to the discovery node service.
- a service to connect to the inference agent.
- an RMS node containing RMS docker image.
- an external service to connect to the RMS node.
You can find sample YAML files at BE_HOME\cloud\kubernetes\rms. For details, see Sample Kubernetes Resource Files for RMS. -
Run the
create command of
kubectl utility using the YAML files to deploy the BusinessEvents and RMS cluster.
For example, deploy the cluster using the sample files:You can get the external IP to the external RMS service, that is, TIBCO BusinessEvents WebStudio URL, using the get services command. You can then use that URL to connect to TIBCO BusinessEvents WebStudio from your browser.
kubectl create -f bejmx-service.yaml kubectl create -f bediscovery-service.yaml kubectl create -f bediscovery.yaml kubectl create -f becache.yaml kubectl create -f beinference.yaml kubectl create -f beinference-service.yaml kubectl create -f berms.yaml kubectl create -f berms-service.yaml
kubectl get services berms-service -o wide
You can check the logs of individual TIBCO BusinessEvents container pods using the following command:kubectl logs <pod>