How do you harden the kubelet?
AdvancedProductionKubernetes Security Posture
Answer
The kubelet API on port 10250 can exec into pods, so it must not be open.
# KubeletConfiguration
authentication:
anonymous: {enabled: false}
webhook: {enabled: true}
authorization:
mode: Webhook
readOnlyPort: 0
protectKernelDefaults: true
rotateCertificates: true
serverTLSBootstrap: true
Also restrict port 10250 to the control plane and monitoring in the node security group, and keep NodeRestriction admission on so a node can only modify its own Node object and its pods. Managed services set most of this already; verify with kube-bench run --targets node.
More on Kubernetes Security Posture
What is your security baseline for a new production EKS cluster?IntermediateDraw the layered security controls for workloads on Kubernetes.BeginnerHow do you assign Pod Security Admission levels across namespaces in production?BeginnerKyverno, OPA Gatekeeper or ValidatingAdmissionPolicy: how do you choose?IntermediateShow a ValidatingAdmissionPolicy that blocks containers without resource limits.AdvancedHow do you roll out default-deny NetworkPolicies in a running production cluster?Intermediate