How are minions chosen for given pod creation request

10/17/2014

How does kubernetes choose the minion among many available for a given pod creation command? Is it something that can be controlled/tweaked ?

If replicated pods are submitted for deployment, is kubernetes intelligent enough to place them in different minions if they expose the same container/host port pair? Or does it always place different replicas in different minions ?

What about corner cases like what if two different pods (not necessarily replicas) that expose same host/container port pair are submitted? Will they carefully be placed on different minions ?

If a pod requires specific compute/memory requirements, can it be placed in a minion/host that has sufficient resources left to meet those requirement?

In summary, is there detailed documentation on kubernetes pod placement strategy?

-- vishr
kubernetes

2 Answers

10/23/2014

Pods are scheduled to ports using the algorithm in generic_scheduler.go

There are rules that prevent host-port conflicts, and also to make sure that there are sufficient memory and cpu requirements. predicates.go

-- brendan
Source: StackOverflow

2/4/2019

One way to choose minion for pod creation is using nodeSelector. Inside the yaml file of pod specify the label of minion for which you want to choose the minion.

 apiVersion: v1
 kind: Pod
 metadata:
  name: nginx1 
  labels:
   env: test
 spec:
  containers:
  - name: nginx 
    image: nginx 
    imagePullPolicy: IfNotPresent
  nodeSelector: 
   key: value
-- Vageesha
Source: StackOverflow