We have noticed that everytime we create a new XtraDB cluster, pxc-0 Pod is scheduled to the same Kubernetes worker node. We have 3 masters and 5 worker nodes in the Kubernetes cluster.
Should this happen? How to balance the load more better?
Depending on your host affinity requirements in cr.yaml, K8S may be scheduling your pod on the same worker, yes. The Operator does not tell K8S where to launch the pod. The operator only says ‘launch a pod with these requirements/restrictions’ and it’s up to K8S to chose and place the pod. For example, if your config says ‘4cpu/8gb’ and pods 2-5 have other things on them already, then pod 1 will always be chosen because it’s the only one with free space.
Thank you. Now challenge is that this pxc-0 Pod is scheduled on to same Kubernetes worker node. This is issue because pxc-0 by default is primary Pod which takes all the reads and writes when we use HAProxy.
How could we say for Kubernetes to schedule pxc-0 to other worker nodes? What kind of options there are?
Check out this K8S documentation on node selection Assigning Pods to Nodes | Kubernetes