Affinity and antiaffinity VM rules

7 views
Skip to first unread message

Alberto Losada

unread,
Feb 10, 2020, 6:54:06 AM2/10/20
to kubevirt-dev
Hi KubeVirt community,

I am recently taken a look at the (anti)affinity rules [1] that can be applied to VMs.  The document explains that "since VMs are a workload type based on Pods" so the same rules are applied. Then, I understand that we can create some advanced rules between apps running in VMs  or even between apps running in VMs and pods in the same cluster, is the last assumption correct?

I would be also interested in some real use cases, currently I spotted a few ones:

- Several replicas of the same application that you prevent to run in the same hardware, e.g high availability. This leads to the creation of an anti-affinity rule.
- Due to latency or other software limitations you would want to have your apps running in the same hardware/rack/datacenter/region. This leads to an affinity rule between different apps.
- You want your VM workloads to run on specific hardware or avoid it. This leads to node (anti)affinity rules. Note that this can be done as well with nodeSelectors.

Any other use case or complex rule you are applied in "real" environments?

Thanks in advance.





Alberto Losada

unread,
Feb 18, 2020, 5:15:43 AM2/18/20
to kubevi...@googlegroups.com

Hi,

After some researching I have created a blog post about advanced scheduling in Kubernetes when using VMs and Pods to deploy your application stack. Comments are welcome, PR [1] and rendered content can be seen in [2]

Also found a forgotten an antiaffinity Pod rule in virt-operator, here it is the PR as well [3]. Thanks to @dbelenky and @slintes for your help.

Regards,

[1] https://github.com/kubevirt/kubevirt.github.io/pull/504

[2] https://deploy-preview-504--kubevirtio.netlify.com/2020/advanced-scheduling-with-affinity-rules

[3] https://github.com/kubevirt/kubevirt/pull/3073

--
You received this message because you are subscribed to the Google Groups "kubevirt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubevirt-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubevirt-dev/3d136eab-acdc-4210-8623-f4e37456b6a0%40googlegroups.com.
-- 
Alberto Losada
Software Engineer
RHCA 
alos...@redhat.com
redhat.com | TRIED. TESTED. TRUSTED. | redhat.com/trusted
Reply all
Reply to author
Forward
0 new messages