Skip to content

Commit 4d63da2

Browse files
Describe appropriate use of node role labels and fixes that should be made
node-roles were not intended for internal use and this KEP clarifies both their use and describes the process for resolving their internal use.
1 parent 79119ce commit 4d63da2

File tree

1 file changed

+213
-0
lines changed

1 file changed

+213
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
---
2+
title: Appropriate use of node-role labels
3+
authors:
4+
- "@smarterclayton"
5+
owning-sig: sig-architecture
6+
participating-sigs:
7+
- sig-api-machinery
8+
- sig-network
9+
- sig-node
10+
- sig-testing
11+
reviewers:
12+
- "@lavalamp"
13+
- "@derekwaynecarr"
14+
- "@liggitt"
15+
approvers:
16+
- "@thockin"
17+
- "@derekwaynecarr"
18+
creation-date: 2019-07-16
19+
last-updated: 2019-07-16
20+
status: implementable
21+
---
22+
23+
# Appropriate use of node-role labels
24+
25+
## Table of Contents
26+
27+
<!-- toc -->
28+
- [Release Signoff Checklist](#release-signoff-checklist)
29+
- [Summary](#summary)
30+
- [Motivation](#motivation)
31+
- [Goals](#goals)
32+
- [Proposal](#proposal)
33+
- [Design Details](#design-details)
34+
- [Implementation History](#implementation-history)
35+
- [Alternatives](#alternatives)
36+
- [Reference](#reference)
37+
<!-- /toc -->
38+
39+
## Release Signoff Checklist
40+
41+
**ACTION REQUIRED:** In order to merge code into a release, there must be an issue in [kubernetes/enhancements] referencing this KEP and targeting a release milestone **before [Enhancement Freeze](https://github.com/kubernetes/sig-release/tree/master/releases)
42+
of the targeted release**.
43+
44+
These checklist items _must_ be updated for the enhancement to be released.
45+
46+
- [ ] kubernetes/enhancements issue in release milestone, which links to KEP: https://github.com/kubernetes/enhancements/issues/1143
47+
- [ ] KEP approvers have set the KEP status to `implementable`
48+
- [ ] Design details are appropriately documented
49+
- [ ] Test plan is in place, giving consideration to SIG Architecture and SIG Testing input
50+
- [ ] Graduation criteria is in place
51+
- [ ] "Implementation History" section is up-to-date for milestone
52+
- [ ] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io]
53+
- [ ] Supporting documentation e.g., additional design documents, links to mailing list discussions/SIG meetings, relevant PRs/issues, release notes
54+
55+
**Note:** Any PRs to move a KEP to `implementable` or significant changes once it is marked `implementable` should be approved by each of the KEP approvers. If any of those approvers is no longer appropriate than changes to that list should be approved by the remaining approvers and/or the owning SIG (or SIG-arch for cross cutting KEPs).
56+
57+
**Note:** This checklist is iterative and should be reviewed and updated every time this enhancement is being considered for a milestone.
58+
59+
[kubernetes.io]: https://kubernetes.io/
60+
[kubernetes/enhancements]: https://github.com/kubernetes/enhancements/issues
61+
[kubernetes/kubernetes]: https://github.com/kubernetes/kubernetes
62+
[kubernetes/website]: https://github.com/kubernetes/website
63+
64+
## Summary
65+
66+
Clarify that the `node-role.kubernetes.io/*` label is for use only by users and external projects and may not be used to vary
67+
Kubernetes behavior. Define migration process for all internal consumers of these labels.
68+
69+
## Motivation
70+
71+
The `node-role.kubernetes.io/master` (and the broader `node-role.kubernetes.io` namespace for labels) was introduced
72+
to provide a simple organizational and grouping convention for cluster users. The labels were reserved solely for
73+
organizing nodes via a convention that tools could recognize to display information to end users, and for use by
74+
opinionated external tooling that wished to simplify conventions for end users. Use of the label by components
75+
within the Kubernetes project (those projects subject to API review) was expressely forbidden. Specifically, no
76+
project could mandate the use of those labels in a conformant distribution, since we anticipated that many deployments
77+
of Kubernetes would have more nuanced control-plane topologies than simply "a control plane node".
78+
79+
Over time, several changes to Kubernetes core and related projects were introduced that depended on the
80+
`node-role.kubernetes.io/master` label to vary their behavior in contravention to the guidance the label was
81+
approved under. This was unintentional and due to unclear reviewer guidelines that have since been more strictly
82+
enforced. Likewise, the complexity of Kubernetes deployments has increased and the simplistic mapping of control
83+
plane concepts to a node has proven to limit the ability of conformant Kubernetes distributions to self-host, as
84+
anticipated.
85+
86+
87+
### Goals
88+
89+
This KEP:
90+
91+
* Clarifies that the use of the `node-role.kubernetes/*` label namespace is reserved solely for end-user and
92+
external Kubernetes consumers, and:
93+
* May not be used to vary behavior within Kubernetes projects that are subject to API review (kubernetes/kubernetes
94+
and all components that expose APIs under the `*.k8s.io` namespace)
95+
* Is not required to be used for a cluster to be conformant
96+
* Describes the locations within Kubernetes that must be changed to use an alternative mechanism for behavior
97+
* Suggests approaches for each
98+
* Describes the timeframe and migration process for Kubernetes distributions and deployments to update labels
99+
100+
101+
## Proposal
102+
103+
### Use of `node-role.kubernetes.io/*` labels
104+
105+
* Kubernetes components MUST NOT set or alter behavior on any label within the `node-role.kubernetes.io/*` namespace.
106+
* Kubernetes components (such as `kubectl`) MAY simplify the display of `node-role.kubernetes.io/*` labels to convey the node roles of a node
107+
* Kubernetes examples and documentation MUST NOT leverage the node-role labels for node placement
108+
* External users, administrators, conformant Kubernetes distributions, and extensions MAY use `node-role.kubernetes.io/*` without reservation
109+
* Extensions are recommended not to vary behavior based on node-role, but MAY do so as they wish
110+
* First party components like `kubeadm` MAY use node-roles to simplify their own deployment mechanisms.
111+
* Conformance tests MUST NOT depend on the node-role labels in any fashion
112+
113+
114+
### Migrating existing deployments
115+
116+
The proposed fixes will all require deployment-level changes. That must be staged across several releases, and it should be possible for
117+
deployers to move early and "fix" the issues that may be caused by their topology.
118+
119+
Therefore, for each change we recommend the following process to adopt the new labels in successive releases:
120+
121+
* Release 1 (1.16):
122+
* Introduce a feature gate for disabling node-role being honored. The gate defaults to on. `NodeRoleBehavior=on`
123+
* Define the new node label with an associated feature gate for each feature area. The gate defaults to off. `FeatureA=off`
124+
* Behavior for each functional area is defined as `NodeRoleBehavior == on && node_has_role || FeatureA == on && node_has_label`
125+
* Deprecation of all node role behavior is announced
126+
* No new components may leverage node-roles within Kubernetes projects.
127+
* Early adopters may label their nodes to opt in to the features, even in the absence of the gate.
128+
* Release 2 (1.17):
129+
* For each new node label, usage is reviewed and as appropriate the label is declared beta/GA and the feature gate is set on
130+
* All Kubernetes deployments should be updated to add node labels as appropriate: `kubectl label nodes -l node-role.kubernetes.io/master LABEL_A=VALUE_A`
131+
* Documentation will be provided on making the transition
132+
* Deployments may set `NodeRoleBehavior=off` after they have set the appropriate labels.
133+
* NOTE: Release 3 starts when all labels graduate to beta
134+
* Release 3 (1.18):
135+
* Default the `NodeRoleBehavior=off`. Admins whose deployments still use the old labels may set `NodeRoleBehavior=on` during 1.17 to get the legacy behavior.
136+
* Deployments should stop setting `NodeRoleBehavior=off` if they opted out early.
137+
* Release 4 (1.19):
138+
* The `NodeRoleBehavior` gate and all feature-level gates are removed, components that attempt to set these gates will fail to start.
139+
* Code that references node-roles within Kubernetes will be removed.
140+
141+
In Release 4 (which could be as early as 1.19) this KEP will be considered complete.
142+
143+
144+
### Current users of `node-role.kubernetes.io/*` within the project that must change
145+
146+
The following components vary behavior based on the presence of the node-role labels:
147+
148+
149+
#### Service load-balancer
150+
151+
The service load balancer implementation previously implemented a heuristic where `node-role.kubernetes.io/master` is used to exclude masters
152+
from the candidate nodes for a service. This is an implementation detail of the cluster and is not allowed. Since there is value in excluding
153+
nodes from service load balancer candidacy in some deployments, an alpha feature gated label `alpha.service-controller.kubernetes.io/exclude-balancer`
154+
was added in Kubernetes 1.9.
155+
156+
This label should be moved to beta in Kube 1.16 at its final name `service-controller.kubernetes.io/exclude-balancer`, its feature gate `ServiceNodeExclusion` should default on in 1.17, the gate `ServiceNodeExclusion` should be declared GA in 1.18, and the gate will be removed in 1.19. The old alpha label should be honored in 1.16 and removed in 1.17.
157+
158+
Starting in 1.16 the legacy code block should be gated on `NodeRoleBehavior=on`
159+
160+
161+
#### Node controller excludes master nodes from consideration for eviction
162+
163+
The `k8s.io/kubernetes/pkg/util/system/IsMasterNode(nodeName)` function is used by the NodeLifecycleController to exclude nodes with a node name
164+
that ends in `master` or starts with `master-` when considering whether to mark nodes as disrupted. A recent PR attempted to change this to use node-roles and was blocked. Instead, the controller should be updated to use a label `node-controller.kubernetes.io/exclude-network-check` to decide whether to exclude nodes from being considered for disruption handling.
165+
166+
167+
#### Kubernetes e2e tests
168+
169+
The e2e tests use a number of heuristics including the `IsMasterNode(nodeName)` function and the node-roles labels to select nodes. In order for conformant Kubernetes clusters to run the tests, the e2e suite must change to use individual user-provided label selectors to identify nodes to test, nodes that have special rules for testing unusual cases, and for other selection behaviors. The label selectors may be defaulted by the test code to their current values, as long as a conformant cluster operator can execute the e2e suite against an arbitrary cluster.
170+
171+
QUESTION: Is a single label selector sufficient to identify nodes to test?
172+
173+
174+
## Design Details
175+
176+
### Test Plan
177+
178+
* Unit tests to verify selection using feature gates
179+
180+
### Graduation Criteria
181+
182+
* New labels and feature flags become beta after one release, GA and defaulted on after two, and are removed after 4 releases.
183+
* Documentation for migrating to the new labels is available in 1.17.
184+
185+
### Upgrade / Downgrade Strategy
186+
187+
As described in the migration process, deployers and administrators have 2 releases to migrate their clusters.
188+
189+
### Version Skew Strategy
190+
191+
Controllers are updated after the control plane, so consumers must update the labels on their nodes before they update controller
192+
processes in 1.18.
193+
194+
## Implementation History
195+
196+
- 2019-07-16: Created
197+
198+
## Alternatives
199+
200+
Allowing core components to use node-role labels was considered and rejected because:
201+
202+
1. The number of impacted components and clusters is anticipated to be small
203+
2. There are 4 releases to update within
204+
3. Some deployment topologies (self-hosted clusters) cannot use service load balancers for control plane components today
205+
4. We wish to prevent additional confusion by providing clear guidance.
206+
207+
208+
## Reference
209+
210+
* https://github.com/kubernetes/kubernetes/pull/35975
211+
* https://github.com/kubernetes/kubernetes/pull/39112
212+
* https://github.com/kubernetes/kubernetes/pull/76654
213+
* https://github.com/kubernetes/kubernetes/pull/80021

0 commit comments

Comments
 (0)