# Compliance

Kubernetes security is complex but critical for protecting your clusters, workloads, and sensitive data. This guide breaks down the key security measures you need to implement, focusing on access control, infrastructure hardening, workload isolation, and compliance alignment. Here’s what you’ll learn:

The article also introduces tools like [Cycore](/content/site-root.html) to automate security tasks, reducing manual effort and ensuring continuous compliance. Whether you're securing a single cluster or managing multi-tenant environments, these practices form the backbone of a secure Kubernetes setup.

## Securing the Kubernetes Infrastructure

The security of your Kubernetes environment hinges on the control plane, nodes, and access management. A weakness in any of these areas can jeopardize the entire cluster. Start by reinforcing the control plane to establish a solid base for your security efforts.

### Hardening the Control Plane

The API server acts as the entry point to your cluster. To protect it, ensure that it uses TLS on port 6443 or 443. Limit its exposure by confining it to private networks or routing access through bastion hosts. For user authentication, opt for [OpenID Connect](https://openid.net/) (OIDC) instead of static tokens or client certificates.

The etcd datastore, which holds cluster data, demands special care. To secure etcd, place it behind a firewall, enforce mutual TLS (mTLS) using a dedicated Certificate Authority, and enable encryption at rest. Only the API server should interact with etcd - no exceptions.

### Setting Up Kubernetes RBAC for Access Control

Role-Based Access Control (RBAC) helps enforce the principle of least privilege by defining who can access specific resources in your cluster. Use Role and RoleBinding for permissions limited to a namespace, and avoid using wildcards (`*`) for resources or actions.

Here’s an example Role that gives read-only access to Pods in the `production` namespace:

```yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  namespace: production
  name: pod-reader
rules:
- apiGroups: [
