简体   繁体   中英

K8s How to deploy pod 1 per specific node, not all node in cluster

Let say I have a cluster with 10 worker nodes and the application is randomly deployed to them. I have a namespace X, have 20 instances of nodejs that want to connect to MySQL Group Replication via MySQL Router.
I want to deploy 1 instance of MySQL Router to every node that has at least 1 of my nodejs application. Is this logic support with the k8s default rule?
Ex:

  • node1: 4 nodejs, 1 router
  • node2: 3 nodejs, 1 router
  • node3: 12 nodejs, 1 router
  • node4: 1 nodejs, 1 router
  • other nodes: no app => no router

在此处输入图片说明

Using Inter-pod affinity :

this pod should (or, in the case of anti-affinity, should not) run in an X if that X is already running one or more pods that meet rule Y.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM