YouTube: https://www.youtube.com/watch?v=1HBP6LkKwLc&list=PLnKL6-WWWE_VtIMfNLW3N3RGuCUcQkDMl&index=13
The high level of automation for the container and microservice lifecycle makes the monitoring of Kubernetes or Swarm more challenging than in more traditional, more static deployments. Any static setup to monitor specific application containers does not work because orchestration tools like Kubernetes or Swarm make their own decisions according to the defined deployment rules. In this talk you will learn how DevOps can cope with challenges in Monitoring and Log Management on Docker Swarm and Kubernetes. We will start with the basics of container monitoring and logging, including APIs and tools, followed by an overview of the key metrics of both platforms. We will speak about cluster-wide deployments for monitoring and log management solutions and how to discover services for log collection and monitoring, tagging of logs and metrics. Finally, we will share insights derived from monitoring a 4700 node Swarm cluster, as part of the Swarm3k project.
7. Orchestration
Container
POD
Node Node 1
POD 1
Namespace
ns1
Kibana Elasticsearch
POD 2
Namespace
ns2
Redis
Services (proxy)
Replication
Controllers
DaemonSets
3
HorizontalPod
Autoscaler
8. Kubernetes Dashboard / Heapster
• Current status
• Shows basic resource usage
for workloads (Pod)
• Simple logs view
• Heapster is required for
autoscaling features
18. Alternatives?
Docker
Log files
json-file or
journald
API
Agent
Remote
Log Storage
Disk
Buffer
Docker API provides
the most complete
information!
Reliable networks and
backend services?
Better buffer & retransmit
in case of failure!
Attach metadata to
logs/metrics or
route data to
different servers or
indices?
“docker logs”
works & logs are
stored on local
disk!
Centralize search,
analytics, alerts,
access permissions
Parse logs
19. Automatic tagging of logs, metrics, events
• Automatic tagging of log / metrics with
• Docker
• Container Name / ID
• Image Name / ID
• Labels / Environment
• Hostname / IP
• Kubernetes
• Namespace, Pod Name , UID
• Swarm
• Swarm Service Name , ID, Compose Project, Container # (scale)
• Single collector for logs, metrics, events, metadata
• Base for correlation and visualisation
23. Smart monitoring agent - all in one
Docker
API
Agent
Remote
Storage
Disk
Buffer
Docker API provides
Labels, Metrics,
Logs, Events …
Reliable networks and
backend services?
Better buffer & retransmit
in case of failure!Auto-tagging using
container labels.
Discovery of
services Centralize logs, metrics,
analytics, alerts, access
permissions
Metrics,
Logs, Events
24. Integrate application monitoring in the stack
- Custom images
- add/remove
app with all req. options
- Start monitoring,
reading config from etcd
App
Config to expose
metrics
App Monitor
Configured for App
Container
Service Discovery
etcd
consul
25. Auto Discovery via Docker API and Labels?
App Container
config to expose
metrics
App MonitorDocker Monitor
run
discovery
Docker
Automatic
run
33. Limit container resources for your apps!
• Set CPU quotas –cpu-quota=6000
• Limit Memory and configure App in container to the same limits!
-m 512mb
• Disable Swap: –memory-swap=-1
• To limit a Docker container from eating all your disk IO use
e.g. –device-write-bps /dev/sda:1mb
34. Automatic Deployment of monitoring agents
• One command to run a service
on each node joining the cluster
• Kubernetes:
• DaemonSet creates a pod per
node
kubectl create -f
sematext-agent.yml
• Swarm:
• Global Service docker
service create –mode
global ...
40. Summary
• Setup of Monitoring & Logging is complex in dynamic environments
• Kubernetes != Swarm (yet). Common base: Docker Containers
• Smart Agents to collect, analyze, aggregate metrics, events and logs
• Auto discovery of containers for data collection
• Use metadata tag metrics & logs as base for correlation and visualization
• Integrate monitoring in application stacks for app specific metrics
• Auto Discovery of services and automatic configuration for application level
monitoring
41. We are engineers!
We develop DevOps tools!
We are DevOps people!
We do fun stuff ;)
http://sematext.com/jobs
42. Thank you for listening! Get in touch!
Stefan
stefan.thies@sematext.com
@seti321
http://sematext.com
@sematext http://sematext.com/jobs
Come talk to us
at the booth
Editor's Notes
Use json-file or journald log drivers
In worst case your logs can be found on the docker host!
No connection issues with TCP and no dependency of Containers to a running logging service (everything can break ...)
And UDP? No dependency on startup, however UDP packets could be dropped and logs would be lost
Use a log shipper
Docker API based
Logspout
Sematext Docker Agent
File based
Rsyslog, Syslog-ng, Fluentd, Logstash, Logagent, ...
Use json-file or journald log drivers
In worst case your logs can be found on the docker host!
No connection issues with TCP and no dependency of Containers to a running logging service (everything can break ...)
And UDP? No dependency on startup, however UDP packets could be dropped and logs would be lost
Use a log shipper
Docker API based
Logspout
Sematext Docker Agent
File based
Rsyslog, Syslog-ng, Fluentd, Logstash, Logagent, ...