How-tos

Monitoring IBM Cloud Container Service with Datadog

Share this post:

In this blog post, we discuss how Datadog easily integrates with the IBM Cloud Container Service to provide full visibility of your containerized workloads and operational consistency with container deployments in a multi-cloud architecture. In the sections below,  we demonstrate how to set up a Kubernetes cluster in IBM Cloud and how to deploy Datadog to monitor it. You can proactively   of your applications hosted on IBM Cloud Container Service.

About IBM Cloud

IBM announced their cloud platform in June of 2014, providing users with a variety of compute choices and over 140 IBM and third-party services. The IBM Cloud Container Service has its own integrated monitoring, but because its users operate in a multi-cloud environment, we’re excited to partner with Datadog to provide users with that operational visibility across environments.

About Datadog

Datadog is a monitoring and analytics platform for infrastructure and applications. Datadog provides full-stack observability by combining infrastructure metrics and events with application performance metrics and end-to-end tracing. The Datadog Agent supports Docker and Kubernetes monitoring, making it a perfect fit for collecting metrics via the IBM Bluemix Container Service. Additionally, Datadog can monitor your containerized applications using its Autodiscovery feature, and includes support for over 200 out of the box integrations..

Setting up a Kubernetes cluster in IBM Cloud

The first step is to create an IBM Cloud account.  After you’ve successfully logged into IBM Cloud, the left-hand navigation will take you to Containers.

Select the Kubernetes Cluster icon. We’re going to create a standard (non-free) cluster below.  If your account only allows you to create a lite (free) cluster, don’t worry — you can still follow along and deploy the Datadog Agent to a lite cluster.

To create a standard cluster, set the following parameters:

  • Cluster name
  • Kubernetes version
  • Datacenter location
  • Machine type – a flavor with pre-defined resources per worker node in your cluster
  • Number of workers – 1 to n based on capacity requirements, and can be scaled up or down after the cluster is running
  • Private and Public VLAN – choose networks for worker nodes (we’ll create for you if you don’t have any yet)
  • Hardware – clusters and worker nodes are always single-tenant and isolated to you, but you can choose the level of isolation to meet your needs (shared workers have multi-tenant hypervisor and hardware whereas dedicated worker nodes are single-tenant down to the hardware level)

See the IBM Cloud documentation for more details on cluster creation.

Once you are satisfied with your selections, click on the Create Cluster button.

To create a cluster from the command line, use the following command:

bx cs cluster-create –name <name> –location <datacenter> –workers 2 –machine-type u1c.2×4 –hardware shared –public-vlan <vlan_id> –private-vlan <vlan_id>

Deploying the Datadog Agent on IBM Cloud Container Service

Because IBM Cloud cluster run on Kubernetes, you can take advantage of DaemonSets to automatically deploy the Datadog Agent on all your nodes (or on specific nodes by using nodeSelectors). You just need to create the following dd-agent.yaml manifest:

apiVersion: extensions/v1beta1

kind: DaemonSet

metadata:

name: dd-agent

spec:

template:

metadata:

labels:

app: dd-agent

name: dd-agent

spec:

containers:

- image: datadog/docker-dd-agent:latest

imagePullPolicy: Always

name: dd-agent

ports:

- containerPort: 8125

name: dogstatsdport

protocol: UDP

env:

- name: API_KEY

value: &lt;YOUR_API_KEY&gt;

- name: KUBERNETES

value: "yes"

- name: SD_BACKEND

value: docker

resources:

requests:

memory: "128Mi"

cpu: "100m"

limits:

memory: "512Mi"

cpu: "250m"

volumeMounts:

- name: dockersocket

mountPath: /var/run/docker.sock

- name: procdir

mountPath: /host/proc

readOnly: true

- name: cgroups

mountPath: /host/sys/fs/cgroup

readOnly: true

volumes:

- hostPath:

path: /var/run/docker.sock

name: dockersocket

- hostPath:

path: /proc

name: procdir

- hostPath:

path: /sys/fs/cgroup

name: cgroups

Then deploy the Datadog Agent as a DaemonSet with the command:

kubectl create -f dd-agent.yaml
Now that the Agent is running on nodes across your Kubernetes cluster, the next step is to configure it.

Check that the Agent is running

You can make sure the Datadog Agent is running by executing:  kubectl get daemonset

If the agent is correctly deployed, the output should look similar to this:

NAME       DESIRED   CURRENT   NODE-SELECTOR   AGE
dd-agent   3         3         <none>          11h
The number of desired and current pods should be equal to the number of running nodes in your Kubernetes cluster (check by running ‘kubectl get nodes’).

Dive into the metrics!

Once the Agent is configured on your Kubernetes nodes, you will see Datadog’s default Kubernetes screenboard among your list of available dashboards.

Monitoring your applications

Now that we are monitoring the health of our Kubernetes cluster, let’s monitor your applications as well. To define which application checks should monitor your pods or containers, add your monitoring settings as annotations.  Datadog’s auto-discovery feature will red pod annotations and use the mto drive you monitoring configurations as containers are scheduled around your cluster.


apiVersion: v1
kind: Pod
metadata:
name: redis
annotations:
service-discovery.datadoghq.com/redis.check_names: '["redisdb"]'
service-discovery.datadoghq.com/redis.init_configs: '[{}]'
service-discovery.datadoghq.com/redis.instances: '[{"host:": "{07c2b926d154bd5dc241f595a572d3349d41d98f2484798a4a616f4fafe1ebc0}{07c2b926d154bd5dc241f595a572d3349d41d98f2484798a4a616f4fafe1ebc0}host{07c2b926d154bd5dc241f595a572d3349d41d98f2484798a4a616f4fafe1ebc0}{07c2b926d154bd5dc241f595a572d3349d41d98f2484798a4a616f4fafe1ebc0}”, “port”: "{07c2b926d154bd5dc241f595a572d3349d41d98f2484798a4a616f4fafe1ebc0}{07c2b926d154bd5dc241f595a572d3349d41d98f2484798a4a616f4fafe1ebc0}port{07c2b926d154bd5dc241f595a572d3349d41d98f2484798a4a616f4fafe1ebc0}{07c2b926d154bd5dc241f595a572d3349d41d98f2484798a4a616f4fafe1ebc0}"}]'
labels:
name: apache
spec:
containers:
- name: redis
image: redis
ports:
- containerPort: 6379

To learn more about how auto-discovery works and best practices around implementing it, check out Datadog’s blog post and documentation.

Conclusion

IBM Cloud Container Service makes it easy to set up a Kubernetes cluster to host your containerized applications. When running such applications in production, operational visibility is required to ensure that applications are running as expected.

If you’re already using IBM Cloud Container Service and want to try out Datadog, you can sign up for a free Datadog trial anytime.

 

 

Program Director, Offering Management, IBM Kubernetes Service & IBM Container Registry

More How-tos stories
May 3, 2019

Kubernetes Tutorials: 5 Ways to Get You Building Fast

Ready to start working with Kubernetes? Want to build your Kubernetes skills? The five tutorials in this post will teach you everything you need to know about how to manage your containerized apps with Kubernetes.

Continue reading

May 3, 2019

Using Portworx to Deploy and Manage an HA MySQL Cluster on IBM Cloud Kubernetes Service

This tutorial is a walkthrough of the steps involved in deploying and managing a highly available MySQL cluster on IBM Cloud Kubernetes Service.

Continue reading

May 2, 2019

Kubernetes v1.14.1 Now Available in IBM Cloud Kubernetes Service

We are excited to announce the availability of Kubernetes v1.14.1 for your clusters that are running in IBM Cloud Kubernetes Service. IBM Cloud Kubernetes Service continues to be the first public managed Kubernetes service to support the latest upstream versions from the community.

Continue reading