2

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:

  1. In order to change CPU-manager-policy field to static, I tried to change config of kubelet by following this: Link
  2. But, CPU-manager-policy field was not changed and still 'none'.
  3. So, I changed 'cpuManagerPolicy' field in /var/lib/kubelet/config.yaml.
  4. Then, I executed 'sudo systemctl restart kubelet'.
  5. 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!

1 Answer 1

2

I solved it. You have to add 'kubeReserved' field in config.yaml file. In addition, you have to remove /var/lib/kubelet/cpu_manager_state file. Then, restart kubelet by executing 'systemctl restart kubelet'.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .