On Linux, by cgroups
Both cpu and memory limits are applied by the kubelet (and container runtime), and are ultimately enforced by the kernel. On Linux nodes, the Linux kernel enforces limits with cgroups. https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/