Logging Architecture | Kubernetes - 0 views
-
Application logs can help you understand what is happening inside your application
-
The easiest and most adopted logging method for containerized applications is writing to standard output and standard error streams.
- ...26 more annotations...
-
In a cluster, logs should have a separate storage and lifecycle independent of nodes, pods, or containers. This concept is called cluster-level logging.
-
A container engine handles and redirects any output generated to a containerized application's stdout and stderr streams
-
An important consideration in node-level logging is implementing log rotation, so that logs don't consume all available storage on the node
-
The two kubelet flags container-log-max-size and container-log-max-files can be used to configure the maximum size for each log file and the maximum number of files allowed for each container respectively.
-
On machines with systemd, the kubelet and container runtime write to journald. If systemd is not present, the kubelet and container runtime write to .log files in the /var/log directory.
-
System components inside containers always write to the /var/log directory, bypassing the default logging mechanism.
-
the logging agent is a container that has access to a directory with log files from all of the application containers on that node.
-
Node-level logging creates only one agent per node and doesn't require any changes to the applications running on the node.
-
Containers write stdout and stderr, but with no agreed format. A node-level agent collects these logs and forwards them for aggregation.
-
If you have an application that writes to a single file, it's recommended to set /dev/stdout as the destination
-
it's recommended to use stdout and stderr directly and leave rotation and retention policies to the kubelet.
-
Using a logging agent in a sidecar container can lead to significant resource consumption. Moreover, you won't be able to access those logs using kubectl logs because they are not controlled by the kubelet.