Kubernetes NodeRestriction Admission Plugin
Required knowledge for the CKS certification.
The NodeRestriction admission plugin is a validating admission controller that limits the Node and Pod objects a kubelet can modify. Without it, a compromised kubelet credential could write labels to attract sensitive workloads, modify the Node objects of other cluster members, or update pods not bound to its own node. The node authorizer scopes read access to the kubelet's own node domain, but it does not scope write access — that is the gap NodeRestriction closes by enforcing node-scoped write boundaries at the API server.
How Node Authorization and NodeRestriction Work Together
Node authorization and the NodeRestriction admission plugin are two separate controls that operate at different points in the request pipeline and address different concerns:
- Authentication — establishes the caller's identity. For node requests this is
system:node:<nodeName>in thesystem:nodesgroup, produced during kubelet TLS bootstrapping. - Node authorizer — a special-purpose authorization mode that grants kubelets the minimum read and write access required to serve their pods. Enable it by adding
Nodeto--authorization-mode. - NodeRestriction admission — a validating admission controller that runs on write requests and restricts modifications to the kubelet's own node and the pods bound to it. Enable it by adding
NodeRestrictionto--enable-admission-plugins.
The node authorizer scopes read access to objects related to pods bound to that kubelet's node. For writes, however, the node authorizer alone permits modifications to nodes, pods, and events cluster-wide without restricting to the kubelet's own objects. NodeRestriction narrows the write surface so that each kubelet can only affect its own node and its bound pods.
The two controls are always used together:
kube-apiserver \
--authorization-mode=Node,RBAC \
--enable-admission-plugins=NodeRestriction,...
What NodeRestriction Restricts
Scope of modification
The NodeRestriction admission plugin applies only to kubelets that use credentials in the system:nodes group with a username in the form system:node:<nodeName>. Such kubelets:
- May modify only their own
NodeAPI object. - May modify only
PodAPI objects bound to their node. - May not update or remove taints from their
NodeAPI object. - May not delete their
NodeAPI object.
Kubelet requests that do not use a system:node:<nodeName> credential are not restricted by this plugin; they remain subject to their existing authorization mechanism.
Node label restrictions
A compromised kubelet that can freely self-label its Node object could attract sensitive workloads through NodeAffinity or nodeSelector rules. NodeRestriction prevents this by enforcing the following label policy:
Forbidden — kubelets may not add, update, or remove:
| Label prefix | Reason for restriction |
|---|---|
node-restriction.kubernetes.io/ | Reserved for administrators to label nodes for workload isolation without risk of self-labeling |
node-role.kubernetes.io/ | Prevents a node from self-declaring a cluster role such as control-plane |
The node-restriction.kubernetes.io/ prefix is specifically designed for workload-isolation use cases: an administrator labels a node with node-restriction.kubernetes.io/purpose=sensitive, sets a matching nodeSelector on sensitive pods, and is guaranteed that no kubelet can self-assign that label to attract those pods.
Allowed — kubelets may manage:
kubernetes.io/hostnamekubernetes.io/archkubernetes.io/osnode.kubernetes.io/instance-typetopology.kubernetes.io/regiontopology.kubernetes.io/zone- Labels with the
kubelet.kubernetes.io/prefix - Labels with the
node.kubernetes.io/prefix
The deprecated beta.kubernetes.io/instance-type, failure-domain.beta.kubernetes.io/region, and failure-domain.beta.kubernetes.io/zone labels are also still allowed for backwards compatibility.
Service Account Token Audience Restriction
When the ServiceAccountNodeAudienceRestriction feature gate is enabled (Beta since Kubernetes v1.33, enabled by default), the NodeRestriction admission plugin also restricts the token audiences a kubelet can request via the TokenRequest API.
Before: A kubelet could request a service account token for any audience, allowing a compromised node to mint tokens usable against arbitrary services.
After: A kubelet can only request tokens for audiences already referenced by pods running on its node — specifically those in projected service account token volumes or CSI driver token requests — or for audiences explicitly granted via RBAC.
To grant a kubelet permission to request tokens for an additional audience, create a ClusterRole with the request-serviceaccounts-token-audience verb and bind it to system:nodes:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: node-audience-my-registry
rules:
- verbs: ["request-serviceaccounts-token-audience"]
apiGroups: [""]
resources: ["my-registry-audience"]
resourceNames: ["my-service-account"]
What Node Authorization Grants (Read Access)
The node authorizer grants kubelets read access to the following resource types related to pods bound to that kubelet's node:
- services
- endpoints
- nodes
- pods
- secrets, configmaps, persistent volume claims, and persistent volumes
This read scope is enforced by the node authorizer, not by NodeRestriction. NodeRestriction exclusively governs write operations.
Enabling and Verifying the Plugin
Enable
Both Node authorization and NodeRestriction admission must be configured on the API server. On kubeadm clusters these are enabled by default. On static configurations, verify or add:
kube-apiserver \
--authorization-mode=Node,RBAC \
--enable-admission-plugins=NodeRestriction,...
Verify
Inspect the running API server pod to confirm both settings are present:
kubectl get pod kube-apiserver-$(hostname) -n kube-system -o yaml \
| grep -E 'authorization-mode|enable-admission-plugins'
Expected output contains Node in --authorization-mode and NodeRestriction in --enable-admission-plugins.
Audit: confirm label protection is active
Apply a label under the node-restriction.kubernetes.io/ prefix directly to a node as a cluster administrator — this should succeed. Then verify that a kubelet credential cannot do the same:
# As a cluster admin — should succeed
kubectl label node <node-name> node-restriction.kubernetes.io/purpose=sensitive
# Confirm kubelets cannot modify this label by reviewing API server audit logs
# for PATCH/PUT requests to Node objects from system:node:* usernames
kubectl get events --field-selector reason=NodeRestriction 2>/dev/null
A denied attempt by a kubelet to modify a restricted label produces an audit event at the ResponseComplete stage with a 403 HTTP code and the user system:node:<nodeName>.
Audit: confirm role-label protection
A kubelet must not be able to self-apply node-role.kubernetes.io/control-plane. Verify no node carries this label unless it was set by an administrator:
kubectl get nodes -l node-role.kubernetes.io/control-plane \
-o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}'
Cross-check the result against the nodes you intentionally designated as control-plane members.
Operational Notes
Kubelets outside system:nodes are not governed by the Node authorizer or NodeRestriction. If your cluster contains kubelets that authenticate via a service account or a certificate not in the system:nodes group, NodeRestriction does not restrict their write access; ensure their permissions are bounded through RBAC instead.
Managed Kubernetes services (EKS, GKE, AKS) enable NodeRestriction by default. The specific feature gate state for ServiceAccountNodeAudienceRestriction depends on the minor version the service runs. Confirm with the platform's release notes.
Future versions may add additional restrictions to ensure kubelets have the minimal set of permissions required to operate correctly.
References
This article is based on information from the following official sources:
- Admission Controllers Reference — NodeRestriction - Kubernetes
- Using Node Authorization - Kubernetes