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

Pod Topology Spread blog post (KEP-3022 KEP-3094 KEP-3243) #39777

Merged
merged 13 commits into from
Apr 13, 2023

Conversation

sanposhiho
Copy link
Member

@sanposhiho sanposhiho commented Mar 4, 2023

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 4, 2023
@sanposhiho
Copy link
Member Author

/sig scheduling

@k8s-ci-robot k8s-ci-robot added the sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. label Mar 4, 2023
@sanposhiho sanposhiho marked this pull request as draft March 4, 2023 05:21
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 4, 2023
@netlify
Copy link

netlify bot commented Mar 4, 2023

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit 1841857
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-io-main-staging/deploys/64385b2f0092510008291e64
😎 Deploy Preview https://deploy-preview-39777--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@kerthcet
Copy link
Member

kerthcet commented Mar 4, 2023

Great! Thanks for opening this.

@sftim
Copy link
Contributor

sftim commented Mar 6, 2023

/area blog

@k8s-ci-robot k8s-ci-robot added the area/blog Issues or PRs related to the Kubernetes Blog subproject label Mar 6, 2023
@bradmccoydev
Copy link
Member

Hello, Comms Shadow for the 1.27 release here. This feature blog is tracked for release, the deadline for submitting the draft is 4th of April- the sooner the better since there's still editing to be done afterward. Any doubt, the Comms team is here to help. Thanks!
/cc @harshitasao

@kerthcet
Copy link
Member

FYI: I'll start to write the blog next week.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. language/en Issues or PRs related to English language sig/docs Categorizes an issue or PR as relevant to SIG Docs. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 25, 2023
Copy link
Member Author

@sanposhiho sanposhiho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kerthcet @denkensk
I wrote the introduction and closing sections so that each person just needs to focus on own section.
Could you give me reviews or some ideas to improve them more?

@@ -0,0 +1,43 @@
---
layout: blog
title: "TBD" // TODO: have a cool title.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@denkensk @kerthcet any ideas? 🙂

Copy link
Member

@denkensk denkensk Mar 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about "Introducing the advanced pod topology spread policy for Kubernetes"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or More fine-gained pod topology spread policies in Kubernetes scheduling.

Copy link
Member Author

@sanposhiho sanposhiho Apr 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the word "fine-grained".
Also, I'd like to mention that these features are coming to beta in v1.27 like many other blog posts did.

So... like Kubernetes 1.27: More fine-grained pod topology spread policies reached beta?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kubernetes 1.27: More fine-grained pod topology spread policies reached beta
sgtm.

@sanposhiho sanposhiho changed the title Place holder for the Pod Topology Spread blog post (KEP-3022 KEP-3094 KEP-3243) Pod Topology Spread blog post (KEP-3022 KEP-3094 KEP-3243) Mar 26, 2023
@harshitasao
Copy link
Contributor

Hello @sanposhiho, we're doing a global reminder about submitting a draft for review for all opted-in feature blogs. If it's at all possible, it is very helpful for the release team to have drafts submitted for review before the hard deadline date, to better plan the release dates and avoid missing out. Thank you!

@kerthcet
Copy link
Member

kerthcet commented Apr 2, 2023

My commit is 7656b49, I can't append directly, maybe I should be a co-author.

Signed-off-by: Kante Yin <kerthcet@gmail.com>
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 3, 2023
@denkensk
Copy link
Member

denkensk commented Apr 5, 2023

denkensk@060f4ec

@sanposhiho plz help to cherry-pick this commit. Thanks

Signed-off-by: Alex Wang <wangqingcan1990@gmail.com>
@kerthcet
Copy link
Member

kerthcet commented Apr 6, 2023

ping @sanposhiho a new commit to address the comments about nodeInclusionPolicy. c01127b

Signed-off-by: Kante Yin <kerthcet@gmail.com>
Copy link
Member

@alculquicondor alculquicondor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from SIG Scheduling (technical PoV)

**Authors:** [Alex Wang](https://github.com/denkensk)(Shopee), [Kante Yin](https://github.com/kerthcet)(DaoCloud), [Kensei Nakada](https://github.com/sanposhiho)(Mercari)

In Kubernetes v1.19, [Pod Topology Spread Constraints](https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/) went to GA.
It is the feature to control how Pods are spread to each failure-domain (regions, zones, nodes etc).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
It is the feature to control how Pods are spread to each failure-domain (regions, zones, nodes etc).
It is the feature to control how Pods are spread in the cluster topology or failure domains (regions, zones, nodes etc).

## KEP-3094: Take taints/tolerations into consideration when calculating PodTopologySpread skew

Before this enhancement, when you deploy a pod with `podTopologySpread` configured, kube-scheduler would
take all inclined nodes(satisfied with pod nodeAffinity and nodeSelector) into consideration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
take all inclined nodes(satisfied with pod nodeAffinity and nodeSelector) into consideration
take the Nodes that satisfy the Pod's nodeAffinity and nodeSelector into consideration

take all inclined nodes(satisfied with pod nodeAffinity and nodeSelector) into consideration
in filtering and scoring, but would not care about whether the node taints are tolerated by the incoming pod or not.
This may lead to a node with untolerated taint best fit the pod in podTopologySpread plugin, and as a result,
the pod will stuck in pending for it violates the nodeTaint plugin.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
the pod will stuck in pending for it violates the nodeTaint plugin.
the pod will stuck in Pending if it doesn't tolerate the taint.

Before this enhancement, when you deploy a pod with `podTopologySpread` configured, kube-scheduler would
take all inclined nodes(satisfied with pod nodeAffinity and nodeSelector) into consideration
in filtering and scoring, but would not care about whether the node taints are tolerated by the incoming pod or not.
This may lead to a node with untolerated taint best fit the pod in podTopologySpread plugin, and as a result,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This may lead to a node with untolerated taint best fit the pod in podTopologySpread plugin, and as a result,
This may lead to a node with untolerated taint as the only candidate for spreading, and as a result,

revision label to Deployment and update it manually at each rolling upgrade (both the label on the
podTemplate and the `labelSelector` in the `topologySpreadConstraints`).

To solve this problem once and for all, and to make more accurate decisions in scheduling, we added a new named
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To solve this problem once and for all, and to make more accurate decisions in scheduling, we added a new named
To solve this problem with a simpler API, we added a new field named

existing pods over which spreading will be calculated for the incoming pod.

With `matchLabelKeys`, you don't need to update the `pod.spec` between different revisions.
The controller/operator just needs to set different values to the same label key for different revisions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The controller/operator just needs to set different values to the same label key for different revisions.
The controller or operator managing rollouts just needs to set different values to the same label key for different revisions.

@sanposhiho
Copy link
Member Author

sanposhiho commented Apr 6, 2023

@alculquicondor I fixed based on your suggestions.

@kerthcet @denkensk I applied what @alculquicondor suggested as it is for now. Please create a commit if you have another idea for your section.

@kerthcet
Copy link
Member

kerthcet commented Apr 7, 2023

Thanks @sanposhiho , LGTMed.

@denkensk
Copy link
Member

denkensk commented Apr 7, 2023

@alculquicondor I fixed based on your suggestions.

@kerthcet @denkensk I applied what @alculquicondor suggested as it is for now. Please create a commit if you have another idea for your section.

OK Thanks LGTM @sanposhiho

@harshitasao
Copy link
Contributor

Hello, Comms Lead for v1.27 here. The publication order and date for the Feature Blog series has been finalized and the tracking board is updated.

The publication date for this article is 17-04-2023 (April 17).

Thank you!

@sanposhiho
Copy link
Member Author

/assign @onlydole

For approval from sig/docs side.

Copy link
Contributor

@sftim sftim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. Here's some feedback based on how we usually write and style articles. I hope it helps.

I also suggested an update to use the official publication date.

---
layout: blog
title: "Kubernetes 1.27: More fine-grained pod topology spread policies reached beta"
date: 2023-04-11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
date: 2023-04-11
date: 2023-04-17

Please update the filename to match.

title: "Kubernetes 1.27: More fine-grained pod topology spread policies reached beta"
date: 2023-04-11
slug: fine-grained-pod-topology-spread-features-beta
evergreen: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure? This represents a commitment by the SIG to keep the content current. However, this doesn't feel like a post that would stay up to date as it is tied to a specific release.

Suggested change
evergreen: true

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This represents a commitment by the SIG to keep the content current.

Ah, OK. I'll delete then.

But, there wasn't a way to control the number of domains over which we should spread.
Some users want to force spreading Pods over a minimum number of domains, and if there aren't enough already present, make the cluster-autoscaler provision them.

Then, we introduced the `minDomains` parameter in the Pod Topology Spread.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Then, we introduced the `minDomains` parameter in the Pod Topology Spread.
Kubernetes v1.24 introduced the `minDomains` parameter for pod topology spread constraints,
as an alpha feature.

Via `minDomains` parameter, you can define the minimum number of domains.

For example, assume there are 3 Nodes with the enough capacity,
and a newly created replicaset has the following `topologySpreadConstraints` in template.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
and a newly created replicaset has the following `topologySpreadConstraints` in template.
and a newly created ReplicaSet has the following `topologySpreadConstraints` in its Pod template.

and a newly created replicaset has the following `topologySpreadConstraints` in template.

```yaml
topologySpreadConstraints:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
topologySpreadConstraints:
...
topologySpreadConstraints:


## Getting involved

These features are managed by the [SIG/Scheduling](https://github.com/kubernetes/community/tree/master/sig-scheduling).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
These features are managed by the [SIG/Scheduling](https://github.com/kubernetes/community/tree/master/sig-scheduling).
These features are managed by Kubernetes [SIG Scheduling](https://github.com/kubernetes/community/tree/master/sig-scheduling).


## How can I learn more?

- [Pod Topology Spread Constraints | Kubernetes](/docs/concepts/scheduling-eviction/topology-spread-constraints/)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [Pod Topology Spread Constraints | Kubernetes](/docs/concepts/scheduling-eviction/topology-spread-constraints/)
- [Pod Topology Spread Constraints](/docs/concepts/scheduling-eviction/topology-spread-constraints/) in the Kubernetes documentation


**Authors:** [Alex Wang](https://github.com/denkensk)(Shopee), [Kante Yin](https://github.com/kerthcet)(DaoCloud), [Kensei Nakada](https://github.com/sanposhiho)(Mercari)

In Kubernetes v1.19, [Pod Topology Spread Constraints](/docs/concepts/scheduling-eviction/topology-spread-constraints/) went to GA.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit)

Suggested change
In Kubernetes v1.19, [Pod Topology Spread Constraints](/docs/concepts/scheduling-eviction/topology-spread-constraints/) went to GA.
In Kubernetes v1.19, [Pod topology spread constraints](/docs/concepts/scheduling-eviction/topology-spread-constraints/)
went to general availability (GA).

In Kubernetes v1.19, [Pod Topology Spread Constraints](/docs/concepts/scheduling-eviction/topology-spread-constraints/) went to GA.
It is the feature to control how Pods are spread in the cluster topology or failure domains (regions, zones, nodes etc).

As time passed, we received feedback from users,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
As time passed, we received feedback from users,
As time passed, we - SIG Scheduling - received feedback from users,

```yaml
topologySpreadConstraints:
- maxSkew: 1
minDomains: 5 # requires 5 Nodes at least.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
minDomains: 5 # requires 5 Nodes at least.
minDomains: 5 # requires 5 Nodes at least (because each Node has a unique hostname)

@kerthcet
Copy link
Member

@sanposhiho can you help to solve these comments? Or another two cherry-picks?

@sanposhiho
Copy link
Member Author

sanposhiho commented Apr 12, 2023

@sftim Thanks for the reviews!

@kerthcet @denkensk
by tomorrow, I will check and probably apply the suggestions from @sftim as they are. If you want to have another change in your section, let me know the commit hash then 🙂

@sanposhiho
Copy link
Member Author

I applied the changes to fix the points from @sftim

@sftim
Copy link
Contributor

sftim commented Apr 13, 2023

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 13, 2023
Copy link
Contributor

@sftim sftim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks
/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 13, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 6b6be3cc3058d90117a5245fe819e4249a340e59

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sftim

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 13, 2023
@k8s-ci-robot k8s-ci-robot merged commit 543dd54 into kubernetes:main Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/blog Issues or PRs related to the Kubernetes Blog subproject cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. language/en Issues or PRs related to English language lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/docs Categorizes an issue or PR as relevant to SIG Docs. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
Status: Published
Development

Successfully merging this pull request may close these issues.

9 participants