Monitoring Multi-Node Kubernetes Cluster running on Raspberry Pi using Datadog

Why do we need IoT Monitoring?

Why Datadog?

  • Step #1: Preparing Raspberry Pi Cluster nodes
  • Step #2: Installing Docker 19.03 on all Pi Nodes
  • Step #3: Setting up Datadog Account
  • Step #4: Installing Your First Datadog Monitoring Agent on Pi nodes using Docker container
  • Step #5: Installing K3s Cluster on Pi nodes
  • Step #6: Viewing Datadog dashboard

Step #1: Preparing Raspberry Pi Cluster nodes

Prerequisite:

  • Macbook/Windows
  • Raspberry Pi 3/4 nodes
  • WGET software installed
  • Raspberry Pi Imager

Installing Raspberry Pi OS

wget https://downloads.raspberrypi.org/raspios_full_armhf_latest

Using Raspberry Pi Imager

SSH to Raspberry Pi nodes

$ssh pi@192.168.1.7$ssh pi @192.168.1.4
pi@raspberrypi:~ $ uname -arn
Linux raspberrypi 4.19.118-v7+ #1311 SMP Mon Apr 27 14:21:24 BST 2020 armv7l GNU/Linuxpi@raspberrypi:~ $

Step #2: Installing Docker 19.03 on each Pi nodes

sudo curl -sSL https://get.docker.com/ | shpi@raspi2:~ $ docker version
Client: Docker Engine - Community
Version: 19.03.4
API version: 1.40
Go version: go1.12.10
Git commit: 9013bf5
Built: Fri Oct 18 16:03:00 2019
OS/Arch: linux/arm
Experimental: false
Server: Docker Engine - Community Engine:
Version: 19.03.8
API version: 1.40 (minimum version 1.12)
Go version: go1.12.17
Git commit: afacb8b
Built: Wed Mar 11 01:29:22 2020 OS/Arch: linux/arm Experimental: false
containerd: Version: 1.2.10
GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339
runc: Version: 1.0.0-rc8+dev
GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657 docker-init:
Version: 0.18.0
GitCommit: fec368
pi@raspi2:~ $

Running Nginx Docker container

pi@raspi2:~ $ docker run -d -p 80:80 nginx
pi@raspi2:~ $ docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESd7055f45bf23 nginx "/docker-entrypoint.…" 2 minutes ago Up About a minute 0.0.0.0:80->80/tcp silly_maxwellpi@raspi2:~ $

Step #3: Creating Datadog Account

DOCKER_CONTENT_TRUST=1 
sudo docker run -d --name dd-agent -v /var/run/docker.sock:/var/run/docker.sock:ro -v /proc/:/host/proc/:ro -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro -e DD_API_KEY=8411XXXXXXXXXXXXba3 achntrl/datadog-agent
sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c43b639522fc achntrl/datadog-agent "/init" 37 seconds ago Up 32 seconds (health: starting) 8125/udp, 8126/tcp dd-agent

Running Datadog agent all the nodes

DOCKER_CONTENT_TRUST=1 
sudo docker run -d --name dd-agent -v /var/run/docker.sock:/var/run/docker.sock:ro -v /proc/:/host/proc/:ro -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro -e DD_API_KEY=8411XXXXXXXXXXXXba3 achntrl/datadog-agent
sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c43b639522fc achntrl/datadog-agent "/init" 37 seconds ago Up 32 seconds (health: starting) 8125/udp, 8126/tcp dd-agent

Visualising both the Pi nodes on Datadog Dashboard

Visualising both the Pi nodes

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ajeet Singh Raina

Ajeet Singh Raina

Docker Captain, Docker Community Leader, Tip of the Captain’s Hat Award Winner, Docker Meetup India Regional Lead, Founder of DockerLabs