Backport Kubernetes log level changes to reduce Kubelet log volume.

Reduce Kubelet log volume by changing frequent log messages
from INFO to DEBUG by backporting Kubernetes commit
8f08db9164b9038b2a62ad3d0290d725bc860744.

Test Plan:  Verify that the Kubelet log volume is reduced during
execution

Pass:  Verified that the Kubelet log volume is greatly reduced by
examining the daemon.log file. Previously informational messages
relating to reconcileState no longer appear at the default log level.

Story: 2009272
Task: 43858

Change-Id: Ibfb2967f5b643269203fc91d884964f93e091d34
This commit is contained in:
Gleb Aronsky 2021-11-03 15:06:08 -04:00
parent c606892b4c
commit 43dfcca67f
2 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,65 @@
From 8f08db9164b9038b2a62ad3d0290d725bc860744 Mon Sep 17 00:00:00 2001
From: Rishabh Jain <rjain3@vmware.com>
Date: Thu, 24 Jun 2021 14:23:06 +0530
Subject: [PATCH] Change log level to Debug
diff --git a/pkg/kubelet/cm/cpumanager/cpu_manager.go b/pkg/kubelet/cm/cpumanager/cpu_manager.go
index 2e5b541ef01..5fd0ec9275f 100644
--- a/pkg/kubelet/cm/cpumanager/cpu_manager.go
+++ b/pkg/kubelet/cm/cpumanager/cpu_manager.go
@@ -375,7 +375,7 @@ func (m *manager) reconcileState() (success []reconciledContainer, failure []rec
for _, pod := range m.activePods() {
pstatus, ok := m.podStatusProvider.GetPodStatus(pod.UID)
if !ok {
- klog.InfoS("ReconcileState: skipping pod; status not found", "pod", klog.KObj(pod))
+ klog.V(4).InfoS("ReconcileState: skipping pod; status not found", "pod", klog.KObj(pod))
failure = append(failure, reconciledContainer{pod.Name, "", ""})
continue
}
@@ -385,21 +385,21 @@ func (m *manager) reconcileState() (success []reconciledContainer, failure []rec
for _, container := range allContainers {
containerID, err := findContainerIDByName(&pstatus, container.Name)
if err != nil {
- klog.InfoS("ReconcileState: skipping container; ID not found in pod status", "pod", klog.KObj(pod), "containerName", container.Name, "err", err)
+ klog.V(4).InfoS("ReconcileState: skipping container; ID not found in pod status", "pod", klog.KObj(pod), "containerName", container.Name, "err", err)
failure = append(failure, reconciledContainer{pod.Name, container.Name, ""})
continue
}
cstatus, err := findContainerStatusByName(&pstatus, container.Name)
if err != nil {
- klog.InfoS("ReconcileState: skipping container; container status not found in pod status", "pod", klog.KObj(pod), "containerName", container.Name, "err", err)
+ klog.V(4).InfoS("ReconcileState: skipping container; container status not found in pod status", "pod", klog.KObj(pod), "containerName", container.Name, "err", err)
failure = append(failure, reconciledContainer{pod.Name, container.Name, ""})
continue
}
if cstatus.State.Waiting != nil ||
(cstatus.State.Waiting == nil && cstatus.State.Running == nil && cstatus.State.Terminated == nil) {
- klog.InfoS("ReconcileState: skipping container; container still in the waiting state", "pod", klog.KObj(pod), "containerName", container.Name, "err", err)
+ klog.V(4).InfoS("ReconcileState: skipping container; container still in the waiting state", "pod", klog.KObj(pod), "containerName", container.Name, "err", err)
failure = append(failure, reconciledContainer{pod.Name, container.Name, ""})
continue
}
@@ -413,7 +413,7 @@ func (m *manager) reconcileState() (success []reconciledContainer, failure []rec
// was allocated.
_, _, err := m.containerMap.GetContainerRef(containerID)
if err == nil {
- klog.InfoS("ReconcileState: ignoring terminated container", "pod", klog.KObj(pod), "containerID", containerID)
+ klog.V(4).InfoS("ReconcileState: ignoring terminated container", "pod", klog.KObj(pod), "containerID", containerID)
}
m.Unlock()
continue
@@ -428,7 +428,7 @@ func (m *manager) reconcileState() (success []reconciledContainer, failure []rec
cset := m.state.GetCPUSetOrDefault(string(pod.UID), container.Name)
if cset.IsEmpty() {
// NOTE: This should not happen outside of tests.
- klog.InfoS("ReconcileState: skipping container; assigned cpuset is empty", "pod", klog.KObj(pod), "containerName", container.Name)
+ klog.V(4).InfoS("ReconcileState: skipping container; assigned cpuset is empty", "pod", klog.KObj(pod), "containerName", container.Name)
failure = append(failure, reconciledContainer{pod.Name, container.Name, containerID})
continue
}
--
2.25.1

View File

@ -60,6 +60,7 @@ Patch4: kubelet-cpumanager-introduce-concept-of-isolated-CPU.patch
Patch5: kubeadm-create-platform-pods-with-zero-CPU-resources.patch Patch5: kubeadm-create-platform-pods-with-zero-CPU-resources.patch
Patch6: enable-support-for-kubernetes-to-ignore-isolcpus.patch Patch6: enable-support-for-kubernetes-to-ignore-isolcpus.patch
Patch7: Revert-use-subpath-for-coredns-only-for-default-repo.patch Patch7: Revert-use-subpath-for-coredns-only-for-default-repo.patch
Patch8: Change-log-level-to-Debug.patch
# It obsoletes cadvisor but needs its source code (literally integrated) # It obsoletes cadvisor but needs its source code (literally integrated)
Obsoletes: cadvisor Obsoletes: cadvisor
@ -854,6 +855,7 @@ install in production.
%patch5 -p1 %patch5 -p1
%patch6 -p1 %patch6 -p1
%patch7 -p1 %patch7 -p1
%patch8 -p1
#src/k8s.io/kubernetes/pkg/util/certificates #src/k8s.io/kubernetes/pkg/util/certificates
# Patch the code to remove eliptic.P224 support # Patch the code to remove eliptic.P224 support