mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-19 08:28:19 +00:00
The actual memory usage on the host is equal to the hypervisor memory usage plus the user memory usage. An OOM killer might kill the shim when the memory limit on host is same with that of container and the container consumes all available memory. In this case, the containerd will never receive OOM event, but get "task exit" event. That makes the `k8s-oom.bats` test fail. The fix is to add a new container to increase the sandbox memory limit. When the container "oom-test" is killed by OOM killer, there is still available memory for the shim, so it will not be killed. Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
35 lines
783 B
YAML
35 lines
783 B
YAML
#
|
|
# Copyright (c) 2020 Ant Group
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
apiVersion: v1
|
|
kind: Pod
|
|
metadata:
|
|
name: pod-oom
|
|
spec:
|
|
runtimeClassName: kata
|
|
restartPolicy: Never
|
|
containers:
|
|
- image: quay.io/kata-containers/sysbench-kata:latest
|
|
imagePullPolicy: IfNotPresent
|
|
name: oom-test
|
|
command: ["/bin/sh"]
|
|
args: ["-c", "sleep 2; stress --vm 2 --vm-bytes 500M --timeout 30s"]
|
|
resources:
|
|
limits:
|
|
memory: 400Mi
|
|
requests:
|
|
memory: 400Mi
|
|
- image: quay.io/kata-containers/sysbench-kata:latest
|
|
imagePullPolicy: IfNotPresent
|
|
name: not-oom
|
|
command: ["/bin/sh"]
|
|
args: ["-c", "sleep inf"]
|
|
resources:
|
|
limits:
|
|
memory: 500Mi
|
|
requests:
|
|
memory: 500Mi
|