KCSA · Domain 2: Kubernetes Cluster Component Security · 22% of the exam
Task 2.4: Kubelet
Kubelet authentication and authorization, anonymous access, the Node authorizer and NodeRestriction, the kubelet API and its configuration file.
Study it
Kubelet, container runtime and kube-proxy
Lesson coming
Sample questions
Try each one before opening the answer. Every option is explained, with the CNCF documentation page that proves it.
Question 1 · choose 1
A scan of older worker nodes finds that each kubelet answers plain HTTP requests on port 10255 and returns the specs of every Pod on the node to any caller. These kubelets are started with command-line flags rather than a configuration file. What removes this exposure?
AEnable the NodeRestriction admission plugin on kube-apiserver
BTurn on serverTLSBootstrap so that the kubelet obtains a cluster-signed serving certificate
CApply a default-deny ingress NetworkPolicy covering port 10255 in every namespace
DSet the kubelet's read-only port to 0, such as readOnlyPort: 0 in a config file
Show the answer and why
AEnable the NodeRestriction admission plugin on kube-apiserver
Incorrect
NodeRestriction limits which Node and Pod objects a kubelet may change through the API; it does not affect what the kubelet itself serves on its ports.
BTurn on serverTLSBootstrap so that the kubelet obtains a cluster-signed serving certificate
Incorrect
A serving certificate applies to the kubelet's HTTPS endpoint. The read-only port is plain HTTP and keeps answering unauthenticated requests.
CApply a default-deny ingress NetworkPolicy covering port 10255 in every namespace
Incorrect
NetworkPolicy selects Pods and their traffic; the kubelet is a node process, and its port is not a Pod that a namespace policy selects.
DSet the kubelet's read-only port to 0, such as readOnlyPort: 0 in a config file
Correct
The read-only port serves without authentication or authorization; setting it to 0 disables it. The configuration file defaults to 0, while the command-line flag defaults to 10255.
The kubelet's read-only port serves information with no authentication or authorization. In a kubelet configuration file readOnlyPort defaults to 0 (disabled), but kubelets started with flags default to port 10255, so the exposure persists until the port is set to 0.
Payment Pods must run only on dedicated nodes, so the platform team will label those nodes and select them with a nodeSelector. The team worries that an attacker who steals the kubelet credentials of another node could put the same label on that node and attract payment Pods. The cluster uses the Node authorizer together with its matching admission plugin. Which approach fits?
AA label under the node-restriction.kubernetes.io/ prefix, such as example.com.node-restriction.kubernetes.io/pci=true
BA label under the node.kubernetes.io/ prefix, such as node.kubernetes.io/pci=true
CA label in the company's own domain, such as pci.example.com/dedicated=true
DAn annotation pci=true on the payment nodes, matched by the payment Pods' nodeSelector
Show the answer and why
AA label under the node-restriction.kubernetes.io/ prefix, such as example.com.node-restriction.kubernetes.io/pci=true
Correct
NodeRestriction forbids kubelets from modifying labels with this prefix, which is reserved for administrators to label nodes for workload isolation.
BA label under the node.kubernetes.io/ prefix, such as node.kubernetes.io/pci=true
Incorrect
NodeRestriction explicitly allows kubelets to add, remove and update node.kubernetes.io/-prefixed labels, so a stolen kubelet credential could set it.
CA label in the company's own domain, such as pci.example.com/dedicated=true
Incorrect
NodeRestriction restricts kubelet changes to labels under the kubernetes.io and k8s.io prefixes; a kubelet can still set labels in other domains on its own Node.
DAn annotation pci=true on the payment nodes, matched by the payment Pods' nodeSelector
Incorrect
A nodeSelector matches node labels, not annotations, so the Pods would match no node; annotations also give no protection against self-modification.
For node isolation, the scheduling guide says to choose label keys that the kubelet cannot modify: with the Node authorizer and NodeRestriction, labels under the node-restriction.kubernetes.io/ prefix can be set only by administrators, so a compromised node cannot relabel itself to attract the workload.
A kubelet is started with --config pointing to a configuration file, and also with a command-line flag (not a feature gate) that sets the same value differently. Which value wins?
AThe configuration file
BWhichever was changed most recently
CNeither; the kubelet refuses to start
DThe command-line flag
Show the answer and why
AThe configuration file
Incorrect
The file is read, but a command-line flag for the same value takes precedence.
BWhichever was changed most recently
Incorrect
Precedence is fixed by source, not by modification time.
CNeither; the kubelet refuses to start
Incorrect
Conflicting values are resolved by precedence; the kubelet still starts.
DThe command-line flag
Correct
The kubelet configuration task notes that command-line flags targeting the same value as the config file override it.
When the kubelet reads both a configuration file and command-line flags, flags for the same field override the file. Security settings applied in the file can therefore be undone by a leftover flag, so both sources need review.
To be limited by the NodeRestriction admission plugin, what credentials must a kubelet use?
AIn the system:nodes group, with username system:node:<nodeName>
BA service account token from the kube-system namespace for the node
CAny client certificate signed by the cluster CA
DAn anonymous identity restricted by NetworkPolicy
Show the answer and why
AIn the system:nodes group, with username system:node:<nodeName>
Correct
The admission controller reference says kubelets must use credentials in the system:nodes group with a username of the form system:node:<nodeName>.
BA service account token from the kube-system namespace for the node
Incorrect
NodeRestriction identifies kubelets by the system:nodes group and node username, not by a service account.
CAny client certificate signed by the cluster CA
Incorrect
Being signed by the CA is not enough; the identity must be in the system:nodes group with a node username.
DAn anonymous identity restricted by NetworkPolicy
Incorrect
Anonymous requests carry no node identity, so the plugin could not tie them to a Node.
NodeRestriction ties each kubelet to its own Node object. It recognizes kubelets by the system:nodes group and the username system:node:<nodeName>, which the Node authorizer also relies on.