Running webMethods Microservices Runtime on Kubernetes

Overview

In previous articles we managed to run webMethods Microservices Runtime inside a Docker container. You can get more information about this here. In this article, we will go through the steps required to run webMethods Microservices Runtime on Kubernetes.

Sample described in this article uses Minikube and on Windows 7. This article does not describe concepts and architecture of Kubernetes.

Prerequisites

  • You have some familiarity with the Docker and Kubernetes technology.
  • You have successfully completed setup described in the section below.

 

Setup

In order for this tutorial to work, you will need to install the following products.

A Hypervisor - Install Virtual Box on your machine - https://www.virtualbox.org/wiki/Downloads

kubectl - Command Line tool to work with Kubernetes. This command line tool can be used to manage and inspect various resources on Kubernetes. Follow the instructions @ https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl to install kubectl in your env.

For Windows 7, you can download .exe from https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/windows/amd64/kubectl.exe and copy it under “c:\k8s” directory.

Minikube - Get the latest version of Minikube from https://github.com/kubernetes/minikube/releases as an example https://github.com/kubernetes/minikube/releases/download/v0.34.1/minikube-windows-amd64

Copy downloaded file under “c:\k8s” directory and rename it to minikube.exe

Note: If using Windows, make sure that you have added c:\k8s in the PATH environment variable.

For the purpose of this tutorial, we will be using webMethods Microservices Runtime Docker image published on Dockerhub. You need to agree to download webMethods Microservices Runtime Docker image from Docker hub https://hub.docker.com/_/softwareag-webmethods-microservicesruntime.

Once you have completed the steps above, we can continue with the instructions below.

Download Templates from Github

Clone the webmethods-microservicesruntime-sample repository. 

git clone https://github.com/SoftwareAG/webmethods-microservicesruntime-samples.git


Go to the root directory of the repository and change directory to kubernetes/minikube. This directory has templates for creating Namespace , Services and Deployments in Kubernetes. 

This directory has three templates that we will be using for our deployment.

sag_wm_msr_namespace.yaml - Template to create the Namespace

sag_wm_msr_dep.yaml - Template to create the Deployment

sag_wm_msr_svc.yaml - Template to create the Service

Start Kubernetes

Execute the following command to start Minikube

minikube start 

Minikube automatically configures to use kubectl. Run the below command to ensure minikube is up and running.

kubectl get nodes

Create Namespace

In general, we are NOT required to create new Namespace for the purpose of this article. However for simplicity, we will create Namespace in our Kubernetes cluster. Consider Namespace as a workspace that allows us to isolate our application from any other applications running in the Kubernetes cluster.

You can get more information about Namespaces in Kubernetes at https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/.

We will create namespace “wm-msr” for this sample application. 

Execute the following command

kubectl create -f sag_wm_msr_namespace.yaml

namespace/wm-msr created

Create Secret

For this article, we are using webMethods Microservices Runtime Docker image published on Docker hub. Execute the following command to create a secret that will be used to access Docker image.  If you are using local Docker registry, you will need to provide parameters accordingly. Make sure that you use --namespace parameter to point to wm-msr Namespace.

kubectl create secret docker-registry regcred --docker-server=https://index.docker.io/v1/ --docker-username=<Docker username> --docker-password=<Docker password> --namespace=wm-msr

secret/regcred created

Create Deployment

Configuration defined in Deployment allows running our containerized application in Kubernetes cluster. Deployment instructs Kubernetes on how to create and update instances of our application. You can get more information about Deployment in Kubernetes @ https://kubernetes.io/docs/tutorials/kubernetes-basics/deploy-app/deploy-intro/ and https://kubernetes.io/docs/concepts/workloads/controllers/deployment/

Execute the following command to create Deployment.

kubectl create -f sag_wm_msr_dep.yaml

deployment.apps/wm-msr-deployment created

Here is a quick overview about various configuration that we used in sag_wm_msr_dep.yaml template that is located in the Git repository.

"namespace: wm-msr" : Ties this deployment configuration with Namespace we created earlier.

"app: wm-msr" : Assigns label “app:wm-msr” to the pods that we are creating.

"replicas: 1" : Allows to scale number of running PODs for webMethods Microservices Runtime.

"image: store/softwareag/webmethods-microservicesruntime:10.3" : Indicates the Docker image tied with the pods

"containerPort: 5555" : Port to expose in the Docker container

"name: wm-msr-port" : Name given to the containerPort, we will use this name in the Service Templates.

"imagePullSecrets:" : Used to pull the Docker image from Docker hub. Uses the secret that we created in Create Secret section.

Create Service

Configurations defined in Service allow accessing our application to the outside world. As pods in Kubernetes cluster can be added or removed at any time, Services in Kubernetes provides an abstraction to access the underlying application. 

You can get more information about Services in Kubernetes @ https://kubernetes.io/docs/concepts/services-networking/service/ and https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/

Execute the following command to create Service.

kubectl create -f sag_wm_msr_svc.yaml

service/wm-msr-svc created

Here is a quick overview about various configuration that we used in sag_wm_msr_svc.yaml template that is located in the Git repository.

"type: NodePort" : Provides a way to expose the service to the outside world.

"app: wm-msr" : Creates selectors to link pods that we created during the Deployment with this Service.

"targetPort: wm-msr-port" : Associates port exposed in the Docker container with the services.

Access Kubernetes Dashboard

Execute the command below to launch Kubernetes Dashboard

minikube dashboard

This will launch Minikube Dashboard in your Browser and will look something like below. Select the Namespace “wm-msr” from the list to get information about pods and Services that are deployed.

Launch Admin UI for webMethods Microservices Runtime

Execute the following command to launch Admin UI of webMethods Microservices Runtime. 

minikube service wm-msr-svc --namespace wm-msr

-   Opening kubernetes service wm-msr/wm-msr-svc in default browser...

If all the operations were successful, you will be able to see Admin UI in your default Browser.

Alternatively, you can get endpoint URL for webMethods Microservices Runtime by executing the following command

minikube service list --namespace wm-msr

Kubectl Cheatsheet

kubectl get pods --namespace wm-msr

List Running pods in wm-msr Namespace


kubectl get services --namespace wm-msr
 

List Running services in wm-msr Namespace

https://kubernetes.io/docs/reference/kubectl/cheatsheet/ provides detailed information about various commands that you can use with kubectl to manage pods and services in Kubernetes.

Stop Kubernetes

Execute the following command to stop minikube

minikube stop
:   Stopping "minikube" in virtualbox ...
-   "minikube" stopped.

Conclusion

In this article, we went over few basics of Kubernetes and how webMethods Microservices Runtime can work with Kubernetes. This is a good starting point for getting familiarized with Kubernetes and local testing environment. If you have any templates to share for Kubernetes and webMethods Microservices Runtime, please share it with others in Github under kubernetes folder.

1 Like

Hi Kalpesh,

In some part of this article, minikube is mentioned. If in case we’re using Rancher Desktop, so how do we follow this by replacing with alternative for minikube?

1 Like

@Mike_Ng , I have not tried it. However, you can follow the same steps for Rancher and see if provided templates are still compatible or not. Infact, with Rancher Desktop, it is even simple as you could just try to launch the container from an image directly.

1 Like