Cloud Security
Kubernetes Security
Hardening clusters, workloads and access in Kubernetes.
- 6 notes
- 50 minutes of reading
Securing the platform that runs your containers
Kubernetes schedules and connects containers across many machines. It is powerful and flexible, but its defaults favour getting things working over locking them down. A fresh cluster often allows any pod to talk to any other pod, lets workloads run with high privilege and stores secrets in a form that is only encoded, not encrypted.
The key ideas
- Protect the control plane: limit who can reach the API server, use strong authentication and keep the cluster up to date.
- Least privilege with RBAC: give people and service accounts only the permissions they need, in the namespaces they need.
- Default-deny networking: network policies block traffic between pods unless you allow it.
- Safe workloads: Pod Security Standards stop privileged containers and risky settings.
- Secrets and audit logs: encrypt secrets at rest, consider an external secret store and keep audit logs.
Where to start
Learn the architecture first, then RBAC and network policies; they prevent the most common attacks. If containers are new to you, begin with container security.
- Kubernetes architecture: control plane, nodes, pods and servicesA plain-language tour of Kubernetes components, from the API server and etcd to nodes, pods, deployments and services, showing where each security control fits. 8 min · Beginner
- Kubernetes RBAC: roles, cluster roles, bindings and service accountsHow Kubernetes role-based access control works, the difference between Roles and ClusterRoles and their bindings, how service accounts fit in, and how to apply least privilege. 9 min · Intermediate
- Kubernetes network policies: default deny and allowing only needed trafficHow Kubernetes NetworkPolicy objects segment pod traffic, why you start with default deny for ingress and egress, and how to allow only the flows each application needs, including DNS. 8 min · Intermediate
- Pod Security Standards and admission control: privileged, baseline and restrictedHow Kubernetes Pod Security Standards define privileged, baseline and restricted profiles, how Pod Security admission enforces them per namespace, and where policy engines add further checks. 8 min · Intermediate
- Kubernetes Secrets and etcd encryption: risks and better optionsWhy Kubernetes Secrets are only base64-encoded by default, how to turn on encryption at rest with a KMS provider, how to lock down etcd and its backups, and when to use an external secret store instead. 8 min · Advanced
- Hardening a Kubernetes cluster: API access, upgrades, auditing and CIS ideasA practical plan for hardening a Kubernetes cluster: restricting API server access, securing nodes and the kubelet, staying on supported versions, enabling audit logging and checking against the CIS Kubernetes Benchmark. 9 min · Advanced