Skip to main content
Security & multi-tenancyLesson 13 of 13

Viewing the cluster through the 4Cs and a threat model (KCSA·KCNA)

This covers the 4Cs in Overview of Cloud Native Security (14%) and the Kubernetes Threat Model (16%) in the KCSA domains, and ties into the security items within Container Orchestration (28%) in the KCNA. As one attacker starts outside and tries to cross the boundaries one by one, we follow where each threat model item arises and which control stops it.

Attacker positionoutside
Threat itemTrust boundaries & data flow
Control that stopped it-
Cloud · infrastructureClusterContainer · CodeAttackeroutsidewebapp containerAPI serverrequest gatewayetcdstores Secretsnode-1worker nodeAudit logper-request recordDBsensitive datanormal request
RequestResponse / report

What you will learn

  • How the 4Cs (Cloud, Cluster, Container, Code) wrap each other from the outside in
  • Reading the diagram as trust boundaries and data flows
  • Where the seven threat model items arise
  • Matching controls per boundary: NetworkPolicy, RBAC, Pod Security Standards, Secret encryption, audit logs

Common exam questions​

SituationWhat to do / commandTrap
Asked for the 4C orderFrom the outside: Cloud → Cluster → Container → CodeInner layers rely on outer ones. Protecting only the code is not enough
A compromised pod reaches other podsA default-deny NetworkPolicy in the namespace, allowing only needed trafficBy default, all pods can talk to each other
Privilege escalation via the pod tokenLeast-privilege service accounts, automountServiceAccountToken: falseEven pod-create rights are a path to borrowing another account's rights
Protecting Secretsetcd encryption at rest (EncryptionConfiguration) + narrower Secret read RBACbase64 is not encryption
Denial of servicerequests and limits, ResourceQuota, API Priority and FairnessWithout limits, one pod can starve its neighbors on the node
Tracing persistence and breach pathsCheck create and exec requests and their users in the audit logAudit logs exist only if an audit policy is configured

To go deeper into each boundary's defenses, continue with the lessons Blocking and Allowing Traffic (NetworkPolicy), Who Can Do What (RBAC), Pod Security Standards and securityContext and Audit Logs.

Try it yourself​

kubectl get networkpolicy -A # Default-deny in each namespace?
kubectl get ns -L pod-security.kubernetes.io/enforce # Pod Security Standard per namespace
kubectl auth can-i --list --as=system:serviceaccount:<namespace>:<sa> # What a pod's token can do
kubectl get resourcequota -A # Quotas that cap denial of service
sudo grep -E 'encryption-provider-config|audit-policy-file' /etc/kubernetes/manifests/kube-apiserver.yaml # Secret encryption and audit on? (kubeadm)

Check yourself

  1. An attacker controls the web container and tries to connect straight to the DB Pod. Which control stops this lateral movement?
  2. The attacker uses the ServiceAccount token mounted in web to create Pods through the API server. What reduces this privilege escalation?
  3. After the attack, you want to trace which ServiceAccount did what, and when. What must have been set up in advance?

Further reading: CNCF certification curriculum · Overview of cloud native security · Multi-tenancy