Monitoring Docker Container and Dockerized ApplicationsAuthors: Meenakshi, Satya, Rahul and AnanthContainer technology has been in existence for a long time in the form of LXC. It combines kernel control groups to isolate a process’s resource and support isolated namespaces. Docker came up with multiple added advantages over LXC,Some of them are listed below.
- Portable deployment across machines. Docker defines a format for bundling an application and all its dependencies into a single object which can be transferred to any docker-enabled machine, and executed there with the guarantee that the environment exposed to the application will be the same
- Application-centric. Docker is optimized for the deployment of applications,as opposed to machines. This is reflected in its API, user interface, designphilosophy and documentation
- Automatic build. Docker includes a tool for developers to automatically assemble a container from their source code, with full control over application dependencies, build tools, packaging etc.
- Versioning. Docker includes git-like capabilities for tracking successive versions of a container.
- Component re-use. Any container can be used as a "base image" to create more specialized components.
- Sharing. Docker has access to a public registry.
- Tool ecosystem. Docker defines an API for automating and customizing the creation and deployment of containers. There are a huge number of toolsintegrating with docker to extend its capabilities.
Challange:
- But don’t we need to monitor our system, containers, Applications running for our production system?
- How can we monitor such a distributed system, containers and distributed applications?
There could be three approaches for monitoring and remedy:
1. Reactive:
This kind of monitoring can be achived by the orchestration engine updates the monitoring system.
Example:
Puppet: if any changes to configuration happens it revert back to the actual configuration which management config needs
2. Proactive:
This kind of monitoring can be achived by adding precautionary measures for the known issues, where, if the issue occurs it immidiately starts the precaution to eradicate the fault.
3. Adaptive:
This is better suited for monitoring a frequently changing system like docker containers, as it can adapt itself to the micro services that get intorduced into the containers. Now the question is “Is the adaptive montoring a full solution to the abovementioned challenges?"
- Answer is “NO”
- We need solutions at different levels
Different levels need to be monitoredThe cluster manager:The cluster manager manages the life cycle of a cluster of containers, few present day options are kubernetes and docker swarm
What needs monitoring ?
- Checking if the cluster manager is up and running and in ahealthy state
- Are nodes connected as per the correct expected configuration ?
The cluster nodes:The cluster nodes contains the compute nodes or the VMs over which the containers would be provisioned.
What needs monitoring ?
- CPU utilization
- Memory utilization
- Swap space used
- Disk space used
Docker:
The docker runs a demon on each docker node we need to ensure the docker daemon is healthy and running
The Container: The containers runs the micro services of the application so we need to ensure that the container is up and running and the vital points we need to look are:
- CPU utilization
- Memory utilization
- Disk space used
- Network I/O
This is the most critical part to monitor and the complex part also as the applications are moving towards the distributed applications.
Container Advisor(cAdvisor) provides resource uses and performance characterstics of the running containers . cAdvisor has native support for docker containers.
The Application(micro service):While monitoring the application, we need something which can be adaptive to the system and quickly adjust to the changes in the new enviornment and be able to take control and sustain itself Which means, one needs to take care of app status, app messages, appinstance failure management, health manager detects and advises, new app instance deployed, routing tables etc.,