OpsCanary
Back to daily brief
securitynetwork securityPractitioner

Mastering Access Control for the Kubernetes API

5 min read Kubernetes DocsApr 23, 2026
PractitionerHands-on experience recommended

In a world where security breaches can lead to catastrophic failures, controlling access to the Kubernetes API is non-negotiable. The API serves as the gateway to your cluster, and if not properly secured, it can expose sensitive data and resources. By implementing robust access control mechanisms, you can ensure that only authorized users and applications interact with your Kubernetes environment.

When a request reaches the API, it undergoes several critical stages: transport security, authentication, authorization, admission control, and auditing. The API server listens on port 6443 by default, protected by TLS, ensuring that data in transit is encrypted. Once the TLS connection is established, the request is authenticated using various modules. If the request is authenticated, it then moves to the authorization stage, where existing policies determine if the user has the necessary permissions. Admission controllers can further modify or reject requests based on specific criteria, while auditing provides a chronological record of actions taken within the cluster, which is invaluable for security monitoring.

In production, you need to be aware of the nuances of these mechanisms. For instance, the default secure port is 6443, but you can configure it using the --secure-port parameter. Understanding how to implement policies effectively using JSON, such as defining read-only access for users, is crucial. Remember that while Kubernetes provides a robust framework for access control, misconfigurations can lead to vulnerabilities. Regularly review your authentication and authorization settings to adapt to evolving security needs.

Key takeaways

  • Secure the API server by configuring it to listen on port 6443 with TLS.
  • Authenticate requests using various modules to ensure they come from valid users.
  • Implement authorization policies to control user access to resources.
  • Utilize admission controllers to modify or reject requests based on your criteria.
  • Leverage auditing to maintain a chronological record of actions in your cluster.

Why it matters

In production, a compromised Kubernetes API can lead to unauthorized access to sensitive resources, resulting in data breaches and service disruptions. Proper access control is essential for maintaining the integrity and security of your applications.

Code examples

JSON
{"apiVersion":"abac.authorization.kubernetes.io/v1beta1","kind":"Policy","spec": {"user":"bob","namespace":"projectCaribou","resource":"pods","readonly":true}}
JSON
{"apiVersion":"authorization.k8s.io/v1beta1","kind":"SubjectAccessReview","spec": {"resourceAttributes": {"namespace":"projectCaribou","verb":"get","group":"unicorn.example.org","resource":"pods"}}}

When NOT to use this

The official docs don't call out specific anti-patterns here. Use your judgment based on your scale and requirements.

Want the complete reference?

Read official docs

Test what you just learned

Quiz questions written from this article

Take the quiz →

Get the daily digest

One email. 5 articles. Every morning.

No spam. Unsubscribe anytime.