kubernetes: cpumanager:staticpolicy:smtalign: pod admission failed after kubelet restart
What happened?
When Kubelet is configured with static CPUManager policy + full-pcpus-only option, after kubelet restart, pod is not get admitted and I’m getting the following error under kubelet logs:
Dec 04 12:42:25 kubenswrapper[2410667]: I1204 12:42:25.173086 2410667 kubelet.go:2320] "Pod admission denied" podUID="4355ee04-54b0-4755-b23e-d05ce12e54c1" pod="my-app-namespace/app-deployment" reason="SMTAlignmentError" message="SMT Alignment Error: not enough free physical CPUs: available physical CPUs = 1, requested CPUs = 2, CPUs per core = 1"
After manually deleting and recreating the pod, it gets admitted, so the claim that there are node enough free physical CPUs is wrong.
Pod spec:
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: "2024-12-04T12:50:20Z"
name: app-deployment
namespace: my-app-namespace
resourceVersion: "11109192"
uid: 16737fd6-45e1-4371-b10e-3eff1377c224
spec:
containers:
- args:
- while true; do sleep 10000; done;
command:
- /bin/sh
- -c
image: quay.io/jitesoft/alpine
imagePullPolicy: Always
name: app-container2
resources:
limits:
cpu: "2"
memory: 100Mi
requests:
cpu: "2"
memory: 100Mi
qosClass: Guaranteed
What did you expect to happen?
After kubelet restart pod should readmitted
How can we reproduce it (as minimally and precisely as possible)?
On a node with 4 CPUs:
1 reserved (reserverSystemCPUs)
3 allocatable
- Configure CPUManager to
staticandfull-pcpus-onlyoption totrue - Create a Guaranteed QoS class pod requesting 2 exclusive CPUs:
kind: Pod
...
spec:
containers:
...
resources:
limits:
cpu: "2"
memory: 100Mi
requests:
cpu: "2"
memory: 100Mi
- wait for pod to start
- restart kubelet
- Pod will failed with SMTAlignment error
NOTE:
It’s possible to reproduce the issue on a system with any size of CPUs.
A general formula would be:
On a node with N CPUs:
1 reserved
N-1 allocatable
Create a Guaranteed QoS class pod requesting N / 2 exclusive CPUs:
Anything else we need to know?
No response
Kubernetes version
$ kubectl version
Client Version: v1.29.7
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.31.2
WARNING: version difference between client (1.29) and server (1.31) exceeds the supported minor version skew of +/-1
Cloud provider
OS version
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here
# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, …) and versions (if applicable)
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 17 (10 by maintainers)
Hi @felipeagger,
Thank you for your suggestion. I already proposed a fix alongside filing the issue. You’re welcome to review #129079
Thanks. A reproducer has been added.