Sending output from your program

kubectl logs (as well as the Docker equivalent: docker logs) defaults to combining stdout and stderr and passing anything presented as logs for the container. You may have also had experience with creating specific logging capabilities in your code to write logs to a file location on disk. In general, writing logs to a filesystem location is not encouraged for software running within a container, as to include it in general logging means that something has to read it again, which unnecessarily increases disk I/O.

If you want to have a means of supporting aggregated logging in your application, then you will typically want to have something external to your container and/or Pod defined to help capture, transport, ...

Get Kubernetes for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.