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.
In this file,
-
containerPort: 55560
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. -
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.Note: All applications which are required to be linked with the Application Monitor must specify this label. Port 9998
is used by Monitoring app. This port is not configurable.- Port 2555 is used by Hawk Microagent. This port is not configurable.
To enable monitoring by using Hawk Container Edition, uncomment the following environment variables from sample YAML file :
tcp_self_url
agent_ami_session_url
microagent_name_suffix (optional)
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