The Kubernetes API server endpoint is public. Is that a problem, and what do you do?
BeginnerScenarioKubernetes Security
Answer
Situation read → A public endpoint still needs auth, but it exposes the cluster to credential stuffing and zero-day exploits.
What I'd do →
- Prefer a private endpoint; access via VPN, bastion or SSM.
- If public is needed (for example hosted CI), restrict to known CIDRs:
aws eks update-cluster-config --name prod --resources-vpc-config endpointPublicAccess=true,publicAccessCidrs="203.0.113.0/24",endpointPrivateAccess=true. - Confirm anonymous auth gives nothing useful:
curl -k https://$API/apishould return 401 or 403. - Keep the control plane version current.
Why → Reducing who can reach the API cuts off whole classes of attacks.
Interview tip → Private endpoint plus CI runners inside the VPC is the clean answer.
More on Kubernetes Security
What are the 4Cs of cloud native security?BeginnerWhat happens to a request between `kubectl apply` and etcd from a security point of view?IntermediateExplain Role, ClusterRole, RoleBinding and ClusterRoleBinding.BeginnerHow do you check what a user or service account is allowed to do?BeginnerWhich RBAC permissions are effectively cluster-admin in disguise?AdvancedHow do service account tokens work now, and what is `automountServiceAccountToken`?Intermediate