Apama 10.3 | Apama Documentation | Deploying and Managing Apama Applications | Deploying Apama Applications with Kubernetes | Deploying an Apama application using Kubernetes
Deploying an Apama application using Kubernetes
You will either need to create an image or you will already have images for the application you wish to deploy using Kubernetes. To illustrate the concepts and basic process of getting the image running and interrogating the running containers, this topic describes how to use the Adapter sample which can be found the samples/docker/applications/Adapter directory of your Apama installation. The README.txt files that are provided in the samples/docker/applications directory and in the subdirectory for the Adapter sample guide you through the process of building and running.
1. To create the images, enter the following commands from the samples/docker/applications/Adapter directory (see also Deploying Apama Applications with Docker for details on building images):
cd deployment
docker build -t registrytag-correlator .
cd ../iaf
docker build -t registrytag-iaf .
cd ..
docker push registrytag-correlator
docker push registrytag-iaf
You must replace the tags registrytag-correlator and registrytag-iaf with tags that are valid for a registry that you can write to, in the following form:
To use Kubernetes, you must publish the images in a registry and not just in a local Docker server. You must also include these tags in the Kubernetes configuration file that is used to create the objects. If you are using the kubernetes.yml file from the Adapter sample (which is mentioned below), you must replace the correlator-image and iaf-image lines with your tags.
2. Once you have determined which images you want to use, and know their location and tag name, you can create the YAML configuration file for Kubernetes. This configuration file defines the state that you want from a running system, indicating the runtime characteristics you want Kubernetes to adhere to. This file makes no mention of where things run on a cluster, but it can be used to determine behavior like restarting, replica containers, load balancing and resource restrictions.
Apama provides the example configuration file kubernetes.yml which can be found in the samples/docker/applications/Adapter directory of your Apama installation. Detailed descriptions of the possible contents of a Kubernetes configuration file can be found on the Kubernetes website (https://kubernetes.io/).
The Adapter sample contains two pods and a service tying the running containers together. A service in Kubernetes is an abstraction which enables a loose coupling between dependent pods. Although each pod has a unique IP address, these IP addresses are not exposed outside the cluster without a service. Services allow your applications to receive traffic. Whenever you have a pod which depends on another service, it is recommended that you use an init container to ensure that the service is ready before starting the dependant pod. All the samples involving multiple pods use this pattern.
3. To create the Kubernetes objects (pods and service):
kubectl create -f kubernetes.yml
After you have created the objects defined in the kubernetes.yml file, you can list the pods and the service, and you can examine the details of the running objects, see below.
4. To list the pods:
kubectl get pods
5. To list the service:
kubectl get services
6. To examine the details of the running objects (image, container, volumes, and status events):
kubectl describe pod engine
7. To examine the logs in the correlator instance:
kubectl logs engine
8. To examine the IAF logs:
kubectl logs iaf
9. You can run commands in the pod. For example, to run a single command:
kubectl exec engine 'ls'
Or to open a shell on the running container:
kubectl exec -it engine bash
10. To shut down the application, you use the same YAML file that has been used to start the process:
kubectl delete -f kubernetes.yml
For more samples of Kubernetes configurations applied to Apama images and applications, see Apama samples for Kubernetes.

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.