How to allow only one pod of a type on a node in Kubernetes. Daemon-sets doesn't fit into this use-case.
For e.g. - Restricting scheduling of only one Elasticsearch pod on a node, to prevent data loss in case the node goes down.
It can be achieved by carefully planning CPU/memory resource of pod and machine type of cluster.
Is there any other way to do so?
Kubernetes 1.4 introduced Inter-pod affinity and anti-affinity
. From the documentation: Inter-pod affinity and anti-affinity allow you to constrain which nodes your pod is eligible to schedule on based on labels on pods that are already running on the node
.
That won't prevent a pod to be scheduled on a node, but at least the pod will be scheduled on the node if and only if the scheduler has no choice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With