Security & multi-tenancyLesson 9 of 13
Runtime security — catching abnormal behavior (CKS)
This covers the CKS Monitoring, Logging and Runtime Security (20%) domain and "kernel hardening tools such as AppArmor and seccomp" in System Hardening (10%). Even a container that passed every pre-deploy check can be breached at run time. We follow how to notice, block and investigate abnormal behavior inside a running container. Security standards applied at pod creation are in Pod Security Standards and securityContext, and audit policies in Audit Logs.
Falco alerts0
Blocked attempts0
Who did itunknown
RequestResponse / reportWatchAppears in a later step
What you will learn
- Why every action in a container becomes a system call
- Falco detects but does not block
- Immutability enforced by a read-only root filesystem
- What seccomp and AppArmor each block
- Investigating with Falco alerts and audit logs together
Common exam questions
| Situation | What to do / command | Trap |
|---|---|---|
| Find the container where a shell was opened | Check the rule name and container/pod names in Falco output, then replace that pod | Falco only alerts. You must clean up the pod yourself |
| Add or change a Falco rule | Write it in a local rules file such as falco_rules.local.yaml, not the default rules file | Edits to the default rules file can be overwritten on upgrade |
| Container immutability | readOnlyRootFilesystem: true, with emptyDir only for paths that need writes | Apps that write temp files fail to start without a volume |
| Apply seccomp | securityContext.seccompProfile.type: RuntimeDefault or Localhost | A Localhost profile path is relative to the kubelet seccomp folder |
| Apply AppArmor | Load the profile on the node with apparmor_parser and name it in appArmorProfile | A pod scheduled to a node without the profile cannot start |
| Who ran exec? | Check the user on pods/exec requests in the audit log | Without a rule in the audit policy, nothing is recorded |
Try it yourself
kubectl logs -n falco -l app.kubernetes.io/name=falco -c falco # Falco alerts (Helm install)
kubectl get pod <pod> -o jsonpath='{.spec.securityContext}' # Pod-level seccomp/AppArmor
kubectl get pod <pod> -o jsonpath='{.spec.containers[*].securityContext}' # readOnlyRootFilesystem etc.
sudo aa-status | grep deny-shell # On the node: profile loaded?
sudo grep '"subresource":"exec"' /var/log/kubernetes/audit/audit.log # Who exec'd (path set by --audit-log-path)
Check yourself
Further reading: CNCF certification curriculum · Falco docs · Restrict a container's syscalls with seccomp · Pod Security Standards and securityContext · Audit Logs