Hacker News new | ask | show | jobs
by seabrookmx 9 days ago
> So a lot of 1- CPU Kubernetes pods have been on serial all along

I don't think this is true.

Setting your CPU limit to 1 in Kubernetes does not mean the container sees a single logical processor. It only means the kernel allows it to use 1 core worth of CPU _time_.

If your k8s node is an 8 core node, Java will still see 8 logical processors. It just means you can only use 1/8th of each, or all of one, or some combination in-between.

I've never seen a k8s node running on a single core VM, as most of the cloud providers only use these for their free tier or shared core VM's for the lightest of light workloads.

2 comments

Actually, setting your limit and request to exactly 1 does mean that, in some common kubernetes configs. There will be exactly 1 visible CPU.
Care to name them? I just shelled into a GKE pod with a CPU limit/request set to 1 and I see 8 logical processors from `lscpu` on an 8-vCPU node.
Then your node is probably using the "none" policy rather than the "static" policy.

https://kubernetes.io/docs/tasks/administer-cluster/cpu-mana...

> Setting your CPU limit to 1 in Kubernetes does not mean the container sees a single logical processor

that's incorrect, the jvm has been container aware for nearly a decade (https://bugs.openjdk.org/browse/JDK-8146115)

you are correct about the underlying scheduling. limits don't pin you to a core, you get quotas across all available

Nit: if your requests are equal to limits, and an integer, and the static cpu manager is turned on inside Kubelet, then it will pin to core(s).

https://kubernetes.io/docs/tasks/administer-cluster/cpu-mana...

yeah, fair point. there's all sorts of knobs available to pin to cpus, numa alignment, etc.. my comment only covers vanilla workloads