1
Vote

Orchestrating OverOps with Kubernetes - SaaS model with Remote Collector

This is a short summary on how to orchestrate OverOps containers with Docker and Kubernetes. You should be familiar with Docker and Kubernetes concepts.

 

In this example, we deploy the OverOps SaaS architecture with a remote collector, and the following will be accomplished:

  1. Write dockerfiles to build docker images
  2. Run containers in Kubernetes and create deployments
  3. Build YAML files for auto-deployment to default namespace in Kubernetes

 

1.  Write dockerfiles to build docker images

We will have two images within the image registry.  The first image will contain the java application that will be monitored and the OverOps agent that will monitor the application.  The second image will have the OverOps collector, will collect data as a remote collector from the OverOps agent in the first image, and communicate with the OverOps backend powered by AWS. 

First we need to establish our docker images that will be orchestrated with Kubernetes and sample docker files are provided below.  The first sample dockerfile will install the OverOps agent, and an error-generating stand-alone java application called javajam.  Finally it will run the stand-alone java application with the JVM startup argument for the OverOps agent.

Dockerfile for OverOps Agent & Java Application

FROM openjdk:8

ENV A_SECRET_KEY=<place your OverOps secret key here>

RUN echo "Secret Key: $A_SECRET_KEY"

RUN wget -O - -o /dev/null http://get.takipi.com/takipi-t4c-installer | bash /dev/stdin -i --sk=$A_SECRET_KEY --daemon_host=remote-collector --daemon_port=6060 --machine_name=kubernetes-agent

RUN /opt/takipi/etc/takipi-setup-machine-name T4C-agent-kubernetes

RUN wget https://s3-us-west-1.amazonaws.com/overops/javajam.jar -O javajam.jar

CMD java -agentlib:TakipiAgent -Dtakipi.name=JavaJam -Dtakipi.deployment.name=v1.0 -jar javajam.jar

 

The second sample dockerfile will install the OverOps collector that will receive data from the OverOps Agent in the image above, and sends data to the OverOps backend in the AWS cloud.  It establishes a listen-port as 6060 and assigns a machine name of 'kubernetes-remote-collector'.

 

Sample Dockerfile for OverOps Collector:

FROM openjdk:8

ENV A_SECRET_KEY=<place OverOps secret key here>

RUN echo "Secret Key: $A_SECRET_KEY"

RUN wget -O - -o /dev/null http://get.takipi.com/takipi-t4c-installer | bash /dev/stdin -i --sk=$A_SECRET_KEY --listen_on_port=6060 --machine_name=kubernetes-remote-collector

CMD /opt/takipi/bin/takipi-service -nfd -l

 

Build Docker images with Dockerfiles:

  • Build image using the first dockerfile above. (Java app and OverOps agent).  In this example, we will name the image oo-agent-with-java-app. 
docker build -t oo-agent-with-java-app:v1 .   (note the trailing period)

 

  • Build image using the second dockerfile above.  (OverOps Remote-Collector).  In this example, we will name the image remote-collector. 
docker build -t remote-collector:v1 . (note the trailing period)

 

2.  Run containers in Kubernetes and create deployments

  • Start the container for java application and OverOps agent
kubectl run agent --image=oo-agent-with-java-app:v1
  • Start the container for OverOps remote collector
kubectl run remote-collector --image=remote-collector:v1
  • Expose the remote collector as a service
kubectl expose deployment remote-collector --type=LoadBalancer --port=6060
  • Validate Kubernetes Pods and Deployments are healthy.

  • Now you should be able to see the test application being monitored by OverOps.

   

3.  Build YAML files for auto-deployment in Kubernetes

Here is text for a sample yaml file that automates deployment of the agent and java application in Kubernetes. We'll call it agent-deployment.yaml.

{
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "agent",
"namespace": "default"
},
"spec": {
"replicas": 1,
"selector": {
"matchLabels": {
"run": "agent"
}
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"run": "agent"
}
},
"spec": {
"containers": [
{
"name": "agent",
"image": "oo-agent-with-java-app:v1"}
]
}
}
}
}
  • Deploy yaml into Kubernetes:
kubectl create -f agent-deployment.yaml

Here is text for a sample yaml file that automates deployment of the remote-collector in Kubernetes. We'll call it remote-collector-deployment.yaml.

{
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "remote-collector",
"namespace": "default"
},
"spec": {
"replicas": 1,
"selector": {
"matchLabels": {
"run": "remote-collector"
}
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"run": "remote-collector"
}
},
"spec": {
"containers": [
{
"name": "remote-collector",
"image": "remote-collector:v1"}
]
}
}
}
}
  • Deploy yaml into Kubernetes:
kubectl create -f remote-collector-deployment.yaml 

Here is text for a sample yaml file that exposes the remote-collector as a service in Kubernetes. We'll call it remote-collector-service.yaml.

{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "remote-collector",
"namespace": "default"
},
"spec": {
"ports": [
{
"protocol": "TCP",
"port": 6060,
"targetPort": 6060
}
],
"selector": {
"run": "remote-collector"
},
"type": "LoadBalancer"
},
"status": {
"loadBalancer": {}
}
}
  • Deploy yaml into Kubernetes:
kubectl create -f remote-collector-service.yaml 

 

Validate the java application is being monitored by OverOps.

Comments 0 comments

Please sign in to leave a comment.

Join conversation