Change:
when the pod is evicted due to low imagefs.available, the prompt is difficult to understand. it showed: But the container was evicted not by exceeding its request of 0 ephemeral-storage, but due to reaching the evictionHard of the node. The correct prompt message points out the reason for the pod eviction. don't print "which exceeds its request of 0.", because the container was evicted not by exceeding its request of 0. % oc label mcp worker custom-kubelet-eviction=small-pods evictionHard by creating a kubeletconfig % oc create -f custom-kubelet- custom-kubelet- several minutes, the mcp worker finish rolling out to the latest mc a pod % oc create -f hello-pod- hello-pod- a large file in container, make imagefs.available < 90Gi (the current available disk size is 111G ) command terminated with exit code 137 the node status the pod status % oc get pod -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES hello-pod-2 0/1 ContainerStatusUnknown 1 7m58s 10.131.0.7 ip-10-0-213- <none<none% oc get pod hello-pod-2 -o yaml No response <details</details<detailsaws </details<details</details<details</details<details</details<details</details
/sig node
/assign
/assign
/triage accepted

Discussion:
if !isHardEvictionThreshold(thresholdToReclaim) { gracePeriodOverride = m.config.MaxPodGracePeriodSeconds } <del> message, annotations := evictionMessage(resourceToReclaim, pod, statsFunc) </del> <ins> message, annotations := evictionMessage(resourceToReclaim, pod, statsFunc, thresholds, observations) </ins> var condition *v1.PodCondition if utilfeature.DefaultFeatureGate.Enabled(features.PodDisruptionConditions) { condition = &v1.PodCondition{

wantPodStatus: v1.PodStatus{ Phase:   v1.PodFailed, Reason:  "Evicted", <del> Message: "The node was low on resource: memory. ", </del> <ins> Message: "The node was low on resource: memory. Threshold quantity: 2Gi, available: 1500Mi. ", </ins> }, }, }

Type:    "DisruptionTarget", Status:  "True", Reason:  "TerminationByKubelet", <del> Message: "The node was low on resource: memory. ", </del> <ins> Message: "The node was low on resource: memory. Threshold quantity: 2Gi, available: 1500Mi. ", </ins> }) }

wantPodStatus: v1.PodStatus{ Phase:   v1.PodFailed, Reason:  "Evicted", <del> Message: "The node was low on resource: ephemeral-storage. ", </del> <ins> Message: "The node was low on resource: ephemeral-storage. Threshold quantity: 2Gi, available: 1536Mi. ", </ins> }, }, }

Type:    "DisruptionTarget", Status:  "True", Reason:  "TerminationByKubelet", <del> Message: "The node was low on resource: ephemeral-storage. ", </del> <ins> Message: "The node was low on resource: ephemeral-storage. Threshold quantity: 2Gi, available: 1536Mi. ", </ins> }) }

// nodeConditionMessageFmt is the message for evictions due to resource pressure. nodeConditionMessageFmt = "The node had condition: %v. " // containerMessageFmt provides additional information for containers exceeding requests <del> containerMessageFmt = "Container %s was using %s, which exceeds its request of %s. " </del> <ins> containerMessageFmt = "Container %s was using %s, request is %s, has larger consumption of %v. " </ins> // containerEphemeralStorageMessageFmt provides additional information for containers which have exceeded their ES limit containerEphemeralStorageMessageFmt = "Container %s exceeded its local ephemeral storage limit %q. " // podEphemeralStorageMessageFmt provides additional information for pods which have exceeded their ES limit

OffendingContainersUsageKey = "offending_containers_usage" // StarvedResourceKey is the key for the starved resource in eviction event annotations StarvedResourceKey = "starved_resource" <ins> // thresholdMetMessageFmt is the message for evictions due to resource pressure. thresholdMetMessageFmt = "Threshold quantity: %v, available: %v. " </ins> ) var (

} // evictionMessage constructs a useful message about why an eviction occurred, and annotations to provide metadata about the eviction <del> func evictionMessage(resourceToReclaim v1.ResourceName, pod *v1.Pod, stats statsFunc) (message string, annotations map[string]string) { </del> <ins> func evictionMessage(resourceToReclaim v1.ResourceName, pod *v1.Pod, stats statsFunc, thresholds []evictionapi.Threshold, observations signalObservations) (message string, annotations map[string]string) { </ins> annotations = make(map[string]string) message = fmt.Sprintf(nodeLowMessageFmt, resourceToReclaim) <ins> quantity, available := getThresholdMetInfo(resourceToReclaim, thresholds, observations) if quantity != nil && available != nil { message += fmt.Sprintf(thresholdMetMessageFmt, quantity, available) } </ins> containers := []string{} containerUsage := []string{} podStats, ok := stats(pod)

} } if usage != nil && usage.Cmp(requests) > 0 { <del> message += fmt.Sprintf(containerMessageFmt, container.Name, usage.String(), requests.String()) </del> <ins> message += fmt.Sprintf(containerMessageFmt, container.Name, usage.String(), requests.String(), resourceToReclaim) </ins> containers = append(containers, container.Name) containerUsage = append(containerUsage, usage.String()) }

annotations[StarvedResourceKey] = string(resourceToReclaim) return } <ins> // getThresholdMetInfo get the threshold quantity and available for the resource resourceToReclaim func getThresholdMetInfo(resourceToReclaim v1.ResourceName, thresholds []evictionapi.Threshold, observations signalObservations) (quantity *resource.Quantity, available *resource.Quantity) { for i := range thresholds { threshold := thresholds[i] if signalToResource[threshold.Signal] == resourceToReclaim { observed, found := observations[threshold.Signal] if found { quantity := evictionapi.GetThresholdQuantity(threshold.Value, observed.capacity) return quantity, observed.available } } } return nil, nil } </ins>