Specifying exact number of pods per node then performing image version upgrade

6/7/2018

I have 3 nodes in a k8s cluster and I need exactly 2 pods to be scheduled in each node, so I would end up having 3 nodes with 2 pods each (6 replicas).

I found that k8s have Pod Affinity/Anti-Affinity feature and that seems to be the correct way of doing.

My problem is: I want to run 2 pods per node but I often use kubectl apply to upgrade my docker image version, and in this case k8s should've be able to schedule 2 new images in each node before terminating the old ones - will the newer images be scheduled if I use Pod Affinity/Anti-Affinity to allow only 2 pods per node?

How can I do this in my deployment configuration? I cannot get it to work.

-- stefanobaldo
google-kubernetes-engine
kubernetes

1 Answer

6/7/2018

I believe it is part of kubelet's setting, so you would have to look into kubelet's --max-pods flag, depending on what your cluster configuration is. The following links could be useful:

https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/#kubelet

and

https://kubernetes.io/docs/tasks/administer-cluster/reconfigure-kubelet/

-- iomv
Source: StackOverflow