Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing description in the podAffinity concept documentation #47922

Open
scheduler-tester opened this issue Sep 14, 2024 · 2 comments · May be fixed by #48083
Open

Missing description in the podAffinity concept documentation #47922

scheduler-tester opened this issue Sep 14, 2024 · 2 comments · May be fixed by #48083
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. language/en Issues or PRs related to English language priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. sig/docs Categorizes an issue or PR as relevant to SIG Docs. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@scheduler-tester
Copy link
Contributor

This is a Bug Report

Problem:

We noticed some information is missing in the concept documentation about how existing pods' podAffinity/podAntiAffinity fields affect the scheduling decision for each incoming pod. This makes it difficult to understand how the scheduler respects different affinity rules when making scheduling decisions.

In detail, there're two types of pod affinity rules, namely podAffnity and podAntiAffinity, and within each type, there are requiredDuringSchedulingIgnoredDuringExecution and preferredDuringSchedulingIgnoredDuringExecution. So, each pod has in total four fields for pod affinity rules:

  1. podAffinity.requiredDuringSchedulingIgnoredDuringExecution
  2. podAffinity.preferredDuringSchedulingIgnoredDuringExecution
  3. podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution
  4. podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution

By reading the code we found that the scheduler also needs to consider such fields of existing pods in the cluster when making the decision for each incoming pod:

  1. Consider the following as hard constraints and try to filter out nodes based on them:
    • incoming pod's podAffinity.requiredDuringSchedulingIgnoredDuringExecution
    • incoming pod's podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution
    • existing pods podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution
  2. Consider the following as soft constraints and try to score nodes based on them:
    • incoming pod's podAffinity.preferredDuringSchedulingIgnoredDuringExecution
    • incoming pod's podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution
    • existing pods' podAffinity.requiredDuringSchedulingIgnoredDuringExecution
  3. Ignore the following fields:
    • existing pods' podAffinity.preferredDuringSchedulingIgnoredDuringExecution
    • existing pods' podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution

However, the documentation does not mention how the existing pods' podAffinity and podAntiAffinity affect the scheduling decision.

Proposed Solution:
We suggest to add the following information to the concept documentation, and also the API specification:

  • existing pods' podAffinity/podAntiAffinity's required parts will also be considered when scheduling.
  • existing pods' podAntiAffinity's required part will be considered as hard constraints, and nodes will be filtered out if not matching this.
  • existing pods' podAffinity's required part will be considered as soft constraints, and nodes will be scored based this.
  • existing pods' podAffinity/podAntiAffinity's preferred parts will not be considered when scheduling.

Page to Update:
https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity
https://github.com/kubernetes/website/blob/main/content/en/docs/concepts/scheduling-eviction/assign-pod-node.md

/sig scheduling docs
/language en

@scheduler-tester scheduler-tester added the kind/bug Categorizes issue or PR as related to a bug. label Sep 14, 2024
@k8s-ci-robot k8s-ci-robot added sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/docs Categorizes an issue or PR as relevant to SIG Docs. language/en Issues or PRs related to English language needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 14, 2024
@katcosgrove
Copy link
Contributor

/triage accepted
/priority important-longterm

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 18, 2024
@aryasoni98
Copy link

/assign

aryasoni98 added a commit to aryasoni98/website-kubernetes that referenced this issue Sep 25, 2024
@aryasoni98 aryasoni98 linked a pull request Sep 25, 2024 that will close this issue
aryasoni98 added a commit to aryasoni98/website-kubernetes that referenced this issue Sep 25, 2024
aryasoni98 added a commit to aryasoni98/website-kubernetes that referenced this issue Oct 3, 2024
…es#47922

update assign-pod-node.md

update assign-pod-node.md

Update assign-pod-node.md
aryasoni98 added a commit to aryasoni98/website-kubernetes that referenced this issue Oct 9, 2024
aryasoni98 added a commit to aryasoni98/website-kubernetes that referenced this issue Oct 9, 2024
…es#47922

update assign-pod-node.md

update assign-pod-node.md

Update assign-pod-node.md
aryasoni98 added a commit to aryasoni98/website-kubernetes that referenced this issue Oct 10, 2024
…es#47922

Missing description in the podAffinity concept documentation kubernetes#47922

update assign-pod-node.md

update assign-pod-node.md

Update assign-pod-node.md

Remove Star

Remove Bug
aryasoni98 added a commit to aryasoni98/website-kubernetes that referenced this issue Oct 10, 2024
…es#47922

Missing description in the podAffinity concept documentation kubernetes#47922

update assign-pod-node.md

update assign-pod-node.md

Update assign-pod-node.md

Remove Star

Remove Bug
aryasoni98 added a commit to aryasoni98/website-kubernetes that referenced this issue Oct 14, 2024
…es#47922

Missing description in the podAffinity concept documentation kubernetes#47922

update assign-pod-node.md

update assign-pod-node.md

Update assign-pod-node.md

Remove Star

Remove Bug
aryasoni98 added a commit to aryasoni98/website-kubernetes that referenced this issue Oct 14, 2024
…es#47922

Missing description in the podAffinity concept documentation kubernetes#47922

update assign-pod-node.md

update assign-pod-node.md

Update assign-pod-node.md

Remove Star

Remove Bug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. language/en Issues or PRs related to English language priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. sig/docs Categorizes an issue or PR as relevant to SIG Docs. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: Needs Triage
Development

Successfully merging a pull request may close this issue.

5 participants