Search code examples
kubernetesgoogle-kubernetes-engineamazon-eksazure-aks

Affinity at container level?


I have a daemonset which has a Pod, in that pod I wish to have two containers, a and b. However, I wish to deploy a to all nodes, but b is only needed to nodes satisfying certain selectors.

a and b must be in the same pod. So two daemon sets is not an option.

Is there anyway to achieve this?


Solution

  • It's not possibile to do what you have in mind because the pod is the basic component of Kubernetes and it is not a divisible component, so you cannot deploy the containers in it on different nodes.

    Either you deploy the whole pod to all nodes or on nodes satisfying selectors.