Sample Kubernetes YAML File for Deploying an Application

Sample Kubernetes YAML file for deploying an application is at amsgce-runtime-<version>/samples/kubernetes/amxce_k8s_template.yaml.

In the YAML file, update the application name (<app-name>), application Docker image name (<image-name>), and other placeholders as per your application.

Ports

Port Description
55560 This port is used by Application Monitor to connect to ActiveMatrix Service Grid - Container Edition nodes running in the Kubernetes cluster. Port 55560 is the default JMX port and it is not configurable.
55561 This port is used by gRPC and it is not configurable.
9998 This port is used by Monitoring app. This port is not configurable.
2555 This port is used by Hawk Microagent. This port is not configurable.

Labels

You must add tibco.amxce: application label for all ActiveMatrix Service Grid - Container Edition applications. Application Monitor checks for label "tibco.amxce: application" to discover ActiveMatrix Service Grid - Container Edition pods.

Example application deployment file:

metadata:
 labels:
 app: bookstore
 tibco.amxce: application    #used by TEA agent to discover AMSGCE pods 

Adding Custom Label for an Application

Instead of application label, you can specify custom labels. In the Application Monitor agent deployment file, you must specify custom label by using the POD_LABELS environment variable. You can provide comma-separated values to specify multiple labels.

Example tea-agent.yaml file:

name: POD_LABELS
value: <custom label(s)> 

Application deployment file with custom label:

metadata:
 labels:
 app: bookstore
 tibco.amxce: <custom label>   #used by TEA agent to discover AMSGCE pods 
Note: All applications, which are required to be registered with the Application Monitor, must specify this label.

Environment Variables

You can use the following environment variables to configure the Kubernetes deployment YAML file:

Environment Variable Required? Description

tcp_self_url

agent_ami_session_url

microagent_name_suffix (optional)

No

To enable monitoring by using Hawk Container Edition, uncomment these following environment variables from sample YAML file.

TIBCO_AMXCE_HPA_TRANSPORT No

By default gRPC is used for communication between ActiveMatrix Service Grid - Container Edition applications and Application Monitor agent. To change the mode of communication to JMX, set this environment variable value to JMX.

- name: TIBCO_AMXCE_HPA_TRANSPORT
  value: JMX 

By default gRPC is used:

- name: TIBCO_AMXCE_HPA_TRANSPORT
  value: grpc
Note: In ActiveMatrix Service Grid - Container Edition, instead of running one TIBCO AMSGCE node with more hardware (CPU, memory) capacity, TIBCO recommends to use horizontal scaling and use load balancer with it. For example, instead of running one node with 16 CPU cores and 32 GB RAM, run 4 TIBCO AMSGCE containers, each having 4 CPUs and use load balancer with it.

Kubernetes Rolling Update

To achieve high availability of applications, you can perform a rolling update. Rolling update is a feature of Kubernetes in which you can update deployments with zero downtime. Pods instances are incrementally replaced with new ones. New pods instances are then scheduled on nodes with available resources. For more information about rolling updates, see Kubernetes documentation.

Using Kubernetes Services to Access an Application in a Cluster

In Kubernetes, TIBCO ActiveMatrix applications run as pods. Pods communicate with each other by using services. Therefore, you must use Kubernetes services to connect two dependent applications.

For example, consider Hello World2 application provided at <TIBCO_HOME>/amx/<version>/samples/java/helloworld2.zip. For more information about this sample Hello World2 application, see TIBCO ActiveMatrix Service Grid documentation.

In Kubernetes to run this application, you must set up a service for connecting to Date Manager application. This service must be used as host in the HTTP client resource of the helloworld2 application configuration YAML file. helloworld2 application uses this service to connect to datemanager application. Both helloworld2 and datemanager applications must run in the same namespace.

Sample helloworld2 application configuration YAML file:

resources:
  httpClients:
  - name: HttpClient_DateManagerSOAP
    description: This is updated using Application Configurator (1.0.0)
    host: datemanager-service
    port: '9097'

Sample Kubernetes deployment file for Date Manager application:

apiVersion: v1
kind: Service
metadata:
    name: datemanager-service
    namespace: enhanced-helloworld
spec:
    type: LoadBalancer
    externalIPs:
    - 10.107.174.117
    ports:
    - port: 9097
      targetPort: 9097
      name: appport
    - port: 9998
      targetPort: 9998
      name: monitoringapplicationport
    selector:
        app: datemanager