|
| 1 | +--- |
| 2 | +title: Node Declared Features |
| 3 | +weight: 160 |
| 4 | +--- |
| 5 | + |
| 6 | +{{< feature-state feature_gate_name="NodeDeclaredFeatures" >}} |
| 7 | + |
| 8 | +Kubernetes nodes use _declared features_ to report the availability of specific |
| 9 | +features that are new or feature-gated. Control plane components |
| 10 | +utilize this information to make better decisions. The kube-scheduler, via the |
| 11 | +`NodeDeclaredFeatures` plugin, ensures pods are only placed on nodes that |
| 12 | +explicitly support the features the pod requires. Additionally, the |
| 13 | +`NodeDeclaredFeatureValidator` admission controller validates pod updates |
| 14 | +against a node's declared features. |
| 15 | + |
| 16 | +This mechanism helps manage version skew and improve cluster stability, |
| 17 | +especially during cluster upgrades or in mixed-version environments where nodes |
| 18 | +might not all have the same features enabled. This is intended for Kubernetes |
| 19 | +feature developers introducing new node-level features and works in the |
| 20 | +background; application developers deploying Pods do not need to interact with |
| 21 | +this framework directly. |
| 22 | + |
| 23 | +## How it Works |
| 24 | + |
| 25 | +1. **Kubelet Feature Reporting:** At startup, the kubelet on each node detects |
| 26 | + which managed Kubernetes features are currently enabled and reports them |
| 27 | + in the `.status.declaredFeatures` field of the Node. Only features |
| 28 | + under active development are included in this field. |
| 29 | +2. **Scheduler Filtering:** The default kube-scheduler uses the |
| 30 | + `NodeDeclaredFeatures` plugin. This plugin: |
| 31 | + * In the `PreFilter` stage, checks the `PodSpec` to infer the set of node |
| 32 | + features required by the pod. |
| 33 | + * In the `Filter` stage, checks if the features listed in the node's |
| 34 | + `.status.declaredFeatures` satisfy the requirements inferred for the Pod. |
| 35 | + Pods will not be scheduled on nodes lacking the required features. |
| 36 | + Custom schedulers can also utilize the |
| 37 | + `.status.declaredFeatures` field to enforce similar constraints. |
| 38 | +3. **Admission Control:** The `nodedeclaredfeaturevalidator` admission controller |
| 39 | + can reject Pods that require features not declared by the node they are |
| 40 | + bound to, preventing issues during pod updates. |
| 41 | + |
| 42 | +## Enabling node declared features |
| 43 | + |
| 44 | +To use Node Declared Features, the `NodeDeclaredFeatures` |
| 45 | +[feature gate](/docs/reference/command-line-tools-reference/feature-gates/#NodeDeclaredFeatures) |
| 46 | +must be enabled on the `kube-apiserver`, `kube-scheduler`, and `kubelet` |
| 47 | +components. |
| 48 | + |
| 49 | +## {{% heading "whatsnext" %}} |
| 50 | + |
| 51 | +* Read the KEP for more details: |
| 52 | + [KEP-5328: Node Declared Features](https://github.com/kubernetes/enhancements/blob/6d3210f7dd5d547c8f7f6a33af6a09eb45193cd7/keps/sig-node/5328-node-declared-features/README.md) |
| 53 | +* Read about the [`NodeDeclaredFeatureValidator` admission controller](/docs/reference/access-authn-authz/admission-controllers/#nodedeclaredfeaturevalidator). |
0 commit comments