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

Feature Request: Scale in StatefulSet at an arbitrary position #83224

Closed
cofyc opened this issue Sep 27, 2019 · 11 comments
Closed

Feature Request: Scale in StatefulSet at an arbitrary position #83224

cofyc opened this issue Sep 27, 2019 · 11 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. sig/apps Categorizes an issue or PR as relevant to SIG Apps.

Comments

@cofyc
Copy link
Member

cofyc commented Sep 27, 2019

What would you like to be added:

We encountered a problem in production to run databases with local PVs and StatefulSet. It's inconvenient to scale in the database when pods on the node to delete are not the last ordinal indices of the StatefulSet.

I hope we can scale in StatefulSet at an arbitrary position, e.g. delete pod-1 but keep pod-2 in a StatefulSet of 3 replicas.

Why is this needed:

Although pods created from the same spec in StatefulSet, but are not interchangeable because each of them has associated persistent storage.

node A node B node C
pod-0 pod-2 pod-1

Using local PVs, pods are tied to nodes. When we scale in the node pool or take down a node in the on-premise data center. If the pod on that node is not the last ordinal of the StatefulSet, it's hard to scale in the StatefulSet to free the node. We need at the first scale in the StatefulSet to free the node B, and then migrate the pod-1 to node B.

It requires to migrate data between nodes. It's often unacceptable when the amount of data on the node is large, e.g. databases.

Current StatefulSet has some limitations when pods cannot be rescheduled freely. So, I think it's time to implement an alternative indexing method (https://github.com/kubernetes/community/blob/master/contributors/design-proposals/apps/stateful-apps.md#how-identities-are-managed).

An intuitive solution is to move off the deleted slots. The network identifiers are ordinal, stable the same as before except holes can exist.

I've done a quick hack on builtin StatefulSet using annotations: cofyc/kubernetes@1aea0dd...cofyc:scale-in-statefulset-at-arbitrary-position and verified that basic operations like create, scale in/out work.

@cofyc cofyc added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 27, 2019
@k8s-ci-robot k8s-ci-robot added the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Sep 27, 2019
@Joseph-Irving
Copy link
Member

/sig apps

@k8s-ci-robot k8s-ci-robot added sig/apps Categorizes an issue or PR as relevant to SIG Apps. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Sep 27, 2019
@msau42
Copy link
Member

msau42 commented Sep 30, 2019

@kubernetes/sig-apps-feature-requests

@tedyu
Copy link
Contributor

tedyu commented Sep 30, 2019

basic operations like create, stale in/out work

Did you mean scale in/out ?

@cofyc
Copy link
Member Author

cofyc commented Sep 30, 2019

Yes, sorry, my typo.

@cofyc
Copy link
Member Author

cofyc commented Oct 30, 2019

FYI, I've implemented this feature in CRD based on Kubernetes 1.16.0 StatefulSet code: https://github.com/cofyc/advanced-statefulset

edit: new home https://github.com/pingcap/advanced-statefulset

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 28, 2020
@haosdent
Copy link
Member

@cofyc I think your CRD solution is preferred, so this issue could be closed?

@cofyc
Copy link
Member Author

cofyc commented Jan 31, 2020

this can be closed

@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Mar 1, 2020
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. sig/apps Categorizes an issue or PR as relevant to SIG Apps.
Projects
None yet
Development

No branches or pull requests

7 participants