Log Rotation with containerd from TKGi 1.14.x or higher version
search cancel

Log Rotation with containerd from TKGi 1.14.x or higher version

book

Article ID: 340497

calendar_today

Updated On:

Products

VMware

Issue/Introduction

How to specify customized container-log-max-size or container-log-max-files values in TKGi using containerd runtime.

Environment

VMware Tanzu Kubernetes Grid Integrated Edition 1.x

Resolution

In TKGi using Containerd

To create experimental customized K8s Profile, Please check below:

  • Use cases for K8 profile : https://docs.vmware.com/en/VMware-Tanzu-Kubernetes-Grid-Integrated-Edition/1.14/tkgi/GUID-k8s-profiles.html#kubernetes-profile-use-cases-14

 Please note: Experimental customizations are NOT validated or supported by TKGi team.(Same would be mentioned in above document)

 

Steps to apply customized experimental config "container-log-max-size" as below:

  1. Create profile (took 500 Mi as an example)
  2. tkgi create-kubernetes-profile <kubernetes-profile-JSON-path>
  3.  tkgi update-cluster <Cluster-Name> --kubernetes-profile <Kubernetes-Profile-Name>. ----> ** This will trigger changes in the needed cluster ** 
  4. To validate the changes - ps -ef | grep kubelet (This will show container log size field with increased value)

K8s Profile example:

 

{
    "name":"kubelet-log",
    "description":"kubelet profile",
    "experimental_customizations":[
        {
            "component":"kubelet",
            "arguments":{
                "container-log-max-size": "500Mi"
            }
        }
    ]
 
}

 

N.B:  container-log-max-files parameter can be added like wise container-log-max-size in the K8s Profile