- Introduction
- Architecture
- Prerequisites
- Deployment
- Validation
- Tear Down
- Troubleshooting
- Relevant Material
A common goal of cloud computing is to abstract away operational tasks from applications so that developer efforts can be focused on providing business value. One feature common to most applications is the need to monitor application and hardware metrics. On Google Cloud Platform (GCP) the Stackdriver suite of products addresses the need for monitoring and alerting. Some companies may already have a third party solution, however, and this project demonstrates configuring the use of Datadog in a Kubernetes Engine environment. We show you how to collect nginx metrics and pipe them to your existing Datadog account.
This demo contains a simple deployment script for Kubernetes Engine using personal accounts and Terraform. There is one manifest that deploys the Datadog agents and nginx.
NOTE: Personal account should never be used in a CI/CD pipeline. Provision a service account with all permissions needed to run this when automated.
There is a single Kubernetes Engine cluster with 2 nodes. The datadog-agent.yaml
manifest creates a DaemonSet that runs the Datadog agent on
each node in the cluster. Alongside the Datadog agents are nginx processes that feed metrics to Datadog.
Click the button below to run the demo in a Google Cloud Shell.
All the tools for the demo are installed. When using Cloud Shell execute the following command in order to setup gcloud cli. When executing this command please setup your region and zone.
gcloud init
- Terraform >= 0.11.7
- Google Cloud SDK version >= 204.0.0
- kubectl matching the latest GKE version
- Apache Bench
The specific versions used may not be absolutely required but if you run into issues this may help.
The Google Cloud SDK is used to interact with your GCP resources. Installation instructions for multiple platforms are available online.
The kubectl CLI is used to interteract with both Kubernetes Engine and kubernetes in general. Installation instructions for multiple platforms are available online.
Terraform is used to automate the manipulation of cloud infrastructure. Its installation instructions are also available online.
For many users this won't be necessary as many operating systems have Apache
Bench pre-installed. However it is contained within the apache2-utils
package
for Ubuntu/Debian users, and the httpd-tools
package for CentOS/Redhat users.
Use gcloud auth login <your.account@example.com> --no-launch-browser
to get a link to log in your
gcloud cli to your personal account.
- Create a free account on Datadog or use an existing one.
- Login to the DatadogHQ site and go to Agent Installation to display the text for the Datadog agent Kubernetes manifest. Scroll down until you see
DD_API_KEY
. Copy the value and paste it intomanifests/datadog-agent.yaml
at the same key. - In DatadogHQ site go to "Integrations" -> Type "nginx" in the search bar -> Click on the "NGINX" Tile -> "Configuration" Tab -> "Install Integration" -- NGINX dashboards will now be available in the "Dashboards List"
make create
- Log into your Datadog account.
- Go to the Dashboards page.
- You will see two pre-built Nginx dashboards that contain metrics for the nginx containers.
- Click on NGINX - Metrics.
- From a terminal execute
EXT_IP=http://$(kubectl get svc nginx -n default -ojsonpath='{.status.loadBalancer.ingress[0].ip}/'); echo $EXT_IP
. - If it displays a valid url with an IP address the service is deployed and ready to use. You can access the provided address in a browser to verify that nginx is handling requests. - Run
ab -n 1000 $EXT_IP
- This will run a load test against nginx and generate metrics that will be forwarded to Datadog. - In a few moments you should see data coming into your Datadog dashboard.
Run cd terraform
to get back to the Terraform directory and run terraform destroy
to remove all resources created by this demo.
** No data is displaying in Datadog **
- Make sure you grabbed the
DD_API_KEY
value from the generated datadog-agent.yaml from the Datadog site. It is generated for you for your specific account.
** Terraform fails due to issues with zone or project **
- Make sure your gcloud config has values for core/project and compute/zone.
gcloud config set core/project <YOUR PROJECT>
gcloud config set compute/zone <THE ZONE YOU WANT>
** The install script fails with a Permission denied
when running Terraform **
- The credentials that Terraform is using do not provide the
necessary permissions to create resources in the selected projects. Ensure
that the account listed in
gcloud config list
has necessary permissions to create resources. If it does, regenerate the application default credentials usinggcloud auth application-default login
.
You can find additional information at the following locations
This is not an officially supported Google product