I'm currently managing a Kubernetes cluster with 16 worker nodes, running a daemonset for load distribution across most services. We have over 75 pods per node, and I'm wondering if increasing the number of pods will negatively affect CPU performance due to a high volume of context switches. What kind of impacts can I expect and how can I optimize this setup?
1 Answer
CPUs are quite fast, so you might just need to monitor the CPU load to determine if you need more cores. However, your current daemonset approach may be the real issue here. Running 16 replicas of everything seems excessive for most scenarios. I’d suggest switching to deployments with a more suitable number of replicas for each service; this will help in resource allocation and can reduce context switching issues. Also, consider using pod disruption budgets to make node updates easier.
Don't forget to apply pod affinity rules so that your scheduler can better distribute workloads across the nodes.