kubernetes how to set the maximum size of the log file?

How to set the maximum size of the log file? Or enable log rotation.
In the documentation I have not found anything about this.

Or it is necessary to write a script for this?

  • user unbound variable on docker run
  • Can not resolve hostname in Docker 1.10
  • Unable to access the internet from Kubernetes containers
  • AWS BeansTalk expose docker port
  • How to connect to PostgreSQL server that's run on docker
  • Jenkins docker missing some binaries
  • Gitlab CI with Ionic2 and dockerfile for generating apk
  • Logging with docker-compose: Can I use two drivers at the same time?
  • Run nginx in docker with custom vhost
  • Trying to pull image from private-repo.microsoft.com
  • W: Size of file /var/lib/apt/lists/http.debian.net_debian_dists_jessie_main_binary-amd64_Packages.gz is not what the server reported 9101219 9117278
  • Problems with Dockerbeats dashboard containerName field
  • One Solution collect form web for “kubernetes how to set the maximum size of the log file?”

    I don’t think kubernetes provides log rotation feature now. You can put logrotate configuration in your host machine. Something like this one:

    /var/lib/docker/containers/*/*.log {
      rotate 7
      daily
      size=10M
      compress
      missingok
      delaycompress
      copytruncate
    }
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.