'How to restrict core file size in container on k8s cluster with containerd?

I want to restrict the size of core file for every container on my k8s cluster.
My k8s cluster is v1.20 and using containerd 1.5

I tried to build docker file with command ulimit -c 0

But when the container is created and I send a command ulimit -c then the reply is unlimited

I also tried to mount /etc/security/limits.conf on the pod

# /etc/security/limits.conf  

\* hard core 0  
\* soft core 0

But it didn't work.

I also tried to change containerd's config at /usr/lib/systemd/system/containerd.service
I changed LimitCore=0 and

systemctl restart containerd
systemctl daemon-reload

But when I check the ulimit -c on the pod, it consistently replies unlimited even if I restart the pod.

Please don't ask why do you want to set core file size 0, there are some issues about it.

Let me know if anyone knows the answers thanks!



Solution 1:[1]

Sorry, I got to know.....

The order was wrong....

I should have run systemctl daemon-reload and then systemctl restart containerd

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 JAESANGPARK