I want to set CPU affinity for a Pod in kubernetes. But, I have failed to set and struggled with finding the corresponding documents.
What I understand:
- Basically, CPU manager of k8s considers all CPU cores in a node as a shared pool and use them to run pods that are deployed in the node.
- If one sets CPU-manager-policy field of kubelet to 'static', one could set CPU affinity to Pod by setting CPU request/limit as an integer in .yaml file.
What I did:
- In order to change CPU-manager-policy field to static, I tried to change config of kubelet by following this: Link
- But, CPU-manager-policy field was not changed and still 'none'.
- So, I changed 'cpuManagerPolicy' field in /var/lib/kubelet/config.yaml.
- Then, I executed 'sudo systemctl restart kubelet'.
- The status of the node changed to 'NotReady' and all pods went into pending state.
Environment I'm using:
- k8s version: v1.13.2
- CNI: Calico
- OS: Ubuntu 16.04
- Num of nodes: 2 (1 master, 1 worker)
- Application: istio's sample app named bookinfo
Thank you in advance!