containers[].resources.limits.cpu can limit CPU resources for a pod like:
spec:
containers:
- name: cpu-demo-ctr
image: vish/stress
resources:
limits:
cpu: "1"
requests:
cpu: "0.5"I'd also like to set the number of CPU cores shown to a pod. Is it possible?
As detailed in documentation here the 1 cpu in is equivalent to:
So you can request a core using
cpu: "1"or
cpu: "1000m"But if you want to be more precise - you can allocate like 250m of a CPU:
cpu: "250m"Lastly, if you need more than one cpu you could do:
cpu: "2"