Kubernetes Assessment: 04 Advanced + Security
Difficulty level: Advanced + Security
Language: English
Format: security review, policy, hardening and incident-response assessment
Recommended duration: 3 to 4 hours
Maximum score: 100 points
Passing threshold: 70 points
This assessment contains tasks, submission requirements and grading criteria. It does not contain the full model solution.
1. Assessment Goal
This assessment verifies that you can assess Kubernetes risks structurally, harden workloads, formulate policies and document incident response. The focus is on threat modeling, API Server and Control Plane, RBAC, ServiceAccounts, Pod Security Standards, SecurityContext, NetworkPolicy, supply chain, Admission Control, Secrets Security, Runtime Detection, Compliance Evidence and Incident Response.
After the assessment it should be clear that you can:
- separate Kubernetes attack surfaces into API, nodes, workloads, network, Secrets and supply chain,
- identify RBAC permissions and privilege-escalation paths,
- deliberately reduce ServiceAccount token automounting,
- practically assess Pod Security Standards and SecurityContext,
- formulate NetworkPolicies with default deny, DNS and application allowances,
- evaluate image origin, tag, digest, scan, SBOM and signature status,
- classify Admission Policies in audit/warn/enforce mode,
- describe Secret flows and rotation realistically,
- translate runtime signals and audit evidence into responses,
- document incident response for a compromised Pod and a Secret leak.
2. Prerequisites and Allowed Resources
You need:
- a lab cluster,
kubectl,- permissions to create Namespaces, ServiceAccounts, RBAC, NetworkPolicies and test workloads,
- optionally Kyverno, OPA Gatekeeper or ValidatingAdmissionPolicy,
- optionally Trivy, Grype, Cosign or comparable supply-chain tools,
- optionally Falco, Tetragon, Tracee or comparable runtime signals.
Allowed resources:
- official Kubernetes documentation,
- workshop materials,
- your own notes,
- security checklists and internal policy templates,
kubectl auth can-i,kubectl describe, events, logs and policy reports.
Not allowed:
- production Secrets or customer data,
- real registry or cloud credentials,
- destructive node or cluster operations without lab approval,
- deliberate exfiltration or attack actions outside the lab,
- changes to production clusters.
Recommended namespace:
export NS=exam-security
3. Scenario
A sample app checkout-api runs in namespace shop-prod. The review finds:
- The Deployment uses ServiceAccount
checkout-sa. - There is a Secret
payment-api-token. - The image comes from a private registry.
- A GitOps pipeline synchronizes manifests.
- A runtime alert reports an unexpected shell in the Pod.
- An old manifest contains
privileged: trueand ahostPathmount. - NetworkPolicies are incomplete.
- The Secret rotation path is not documented.
- The security department requires evidence and production stop criteria.
You work in lab namespace exam-security. You must not modify the real shop-prod; instead, prove risks, controls and incident measures through reproducible examples and documents.
4. Expected Submission
Submit a folder or archive with these files:
04-advanced-security-submission/
answers.md
threat-model.md
rbac-review.md
serviceaccount-token-review.md
pod-security-review.md
hardened-deployment.yml
networkpolicies.yml
supply-chain-review.md
admission-policy.md
secrets-review.md
runtime-detection.md
compliance-evidence.md
incident-runbook.md
evidence/
can-i.txt
events.txt
policy-results.txt
logs-summary.txt
cleanup.md
If specific tools are not available in the lab, document that and provide a technically correct substitute assessment. Example: If Cosign is not available, document which signature verification would be required in production and which stop criterion would apply.
5. Part A: Security Questions
Answer the questions with reference to the scenario.
- What are the central attack surfaces of Kubernetes?
- How do Authentication, Authorization and Admission Control interact?
- Which risks arise from
privileged: true,hostPath,hostNetwork,hostPIDandhostIPC? - Why are ServiceAccounts and automatically mounted tokens security-relevant?
- Which RBAC verbs or resources are particularly dangerous and why?
- What do Pod Security Standards
privileged,baselineandrestrictedprovide? - Which SecurityContext fields do you expect for a hardened workload?
- Why does NetworkPolicy reduce lateral movement but not replace encryption?
- Why is DNS egress a separate point in default-deny policies?
- Which supply-chain controls do you expect for production images?
- Why are Kubernetes Secrets insufficiently protected despite Base64?
- Which information belongs in reliable incident evidence?
- What is the difference between prevention, detection and response?
- Why do policy exceptions require owner, justification and expiry date?
- Which immediate measures are required for a compromised Pod and Secret leak?
6. Part B: Threat Model and RBAC Audit
Task B1: Threat model
Create threat-model.md for checkout-api.
Required sections:
- assets and protection value,
- trust boundaries,
- attack surfaces,
- abuse scenarios,
- existing controls,
- missing controls,
- stop criteria,
- evidence.
Minimum assets:
| Asset | Expected assessment |
|---|---|
payment-api-token |
very high protection value |
checkout-sa |
workload identity with possible API access |
Deployment checkout-api |
production workload |
| private image | supply-chain relevant |
| GitOps repository | desired state and approval path |
| Ingress/Gateway route | external attack surface |
Task B2: RBAC audit
Create two ServiceAccounts in the lab:
app-sa,overprivileged-sa.
app-sa should receive only minimal read permissions on ConfigMaps.
overprivileged-sa should intentionally receive risky permissions, for example on Secrets or RoleBindings.
Check effective permissions with kubectl auth can-i.
Required evidence in evidence/can-i.txt:
kubectl auth can-i get configmaps --as system:serviceaccount:exam-security:app-sa -n exam-security
kubectl auth can-i get secrets --as system:serviceaccount:exam-security:app-sa -n exam-security
kubectl auth can-i get secrets --as system:serviceaccount:exam-security:overprivileged-sa -n exam-security
kubectl auth can-i create rolebindings --as system:serviceaccount:exam-security:overprivileged-sa -n exam-security
Document:
- which permissions are acceptable,
- which permissions are critical,
- which escalation path would be possible,
- what the fix looks like.
Task B3: ServiceAccount token automount
Create serviceaccount-token-review.md.
Tasks:
- Create a Deployment
no-api-app. - Set
automountServiceAccountToken: false. - Check in the Pod whether a token was automatically mounted.
- Explain when a workload needs Kubernetes API access and when it does not.
7. Part C: Workload, Network and Supply-Chain Hardening
Task C1: Pod Security Restricted
- Set Pod Security labels for
restrictedinenforce,auditandwarnon the lab namespace. - Try to create an unsafe Pod with
privileged: true. - Document the rejection.
- Create a hardened Pod or Deployment that meets Restricted requirements.
Expected hardening criteria:
runAsNonRoot: true,- defined non-root user,
allowPrivilegeEscalation: false,readOnlyRootFilesystem: true,capabilities.drop: [ALL],seccompProfile: RuntimeDefault,- no host namespace usage,
- no uncontrolled
hostPath, - writable path only through
emptyDiror a dedicated volume.
Task C2: Hardened Deployment
Create hardened-deployment.yml for a safe example application.
The manifest must contain:
- namespace
exam-security, - ServiceAccount without unnecessary API token,
- Pod and container SecurityContext,
- resource Requests and Limits,
- Readiness Probe where technically meaningful,
- clear labels
owner,environment,app, - no real Secrets.
Task C3: NetworkPolicy
Create networkpolicies.yml with:
- default deny for Ingress and Egress,
- DNS egress allowance,
- allowance from
frontendtobackendon TCP port8080, - blocking of all other egress,
- note whether the CNI enforces NetworkPolicies.
Document production follow-up questions:
- Does the Pod need to reach the Kubernetes API?
- Does the Pod need registry, logging, monitoring or external API destinations?
- Are there fixed external targets or only unrestricted internet egress rules?
- How is IPv6 or dual-stack considered?
Task C4: Supply-chain review
Create supply-chain-review.md for an example image.
Required fields:
- registry,
- repository,
- tag,
- digest,
- Pull Policy,
- ImagePullSecret,
- CVE scan result or expected scan process,
- SBOM status,
- signature status,
- build provenance,
- admission requirement,
- stop criterion.
At least these stop criteria must be evaluated:
latestwithout digest in production,- image from an unapproved registry,
- critical CVE without exception,
- missing signature for production workloads,
- Pull Secret without owner or rotation.
Task C5: Admission policy
Create admission-policy.md.
Choose at least two policy goals:
- required labels
owner,environment,cost-center, - prohibit
privileged: true, - require
runAsNonRoot: true, - require resource Requests and Limits,
- only approved registries.
For each policy describe:
- goal,
- scope,
- audit/warn/enforce mode,
- example violation,
- exception process,
- rollback path if the policy is wrong.
You may use Kyverno, OPA Gatekeeper or ValidatingAdmissionPolicy. If none of these tools is available, describe the policy technically with pseudomanifest and operational mode.
8. Part D: Secrets, Detection, Compliance and Incident Response
Task D1: Secrets Security and rotation
Create secrets-review.md with:
- Secret inventory,
- access through RBAC,
- mount type in the Pod,
- risk in logs, events, images and backups,
- etcd/backup risk,
- rotation path,
- comparison of Kubernetes Secret, External Secrets, CSI Secret Store, Sealed Secrets and SOPS,
- incident measure in case of a leak.
Important: Do not use real Secrets. Example values must be clearly recognizable as example values.
Task D2: Runtime detection and audit signals
Create runtime-detection.md.
Define expected signals and responses for:
| Signal | Expected assessment |
|---|---|
| unexpected shell in container | risk, data source, first response, evidence |
write access to /etc, /proc or /sys |
risk, control, response |
| unexpected egress | flow logs, DNS, NetworkPolicy, containment |
| access to Kubernetes API with ServiceAccount | audit logs, RBAC check, token rotation |
suspicious kubectl exec |
user, time, Pod, change reference |
| OOMKill in a security-relevant Pod | separate resource and attack signal |
Task D3: Compliance evidence
Create compliance-evidence.md with at least five findings:
- namespace without Pod Security label,
- ServiceAccount with overly broad permissions,
- Pod without Requests/Limits,
- Secret without rotation note,
- workload without NetworkPolicy.
For each finding document:
- time,
- resource,
- risk,
- evidence,
- owner,
- fix,
- exception with expiry date or remediation deadline,
- retest.
Task D4: Incident runbook
Create incident-runbook.md for a compromised Pod and Secret leak.
Required sections:
- triage,
- isolation,
- evidence preservation,
- containment,
- Secret and token rotation,
- image and CI check,
- rebuild and redeploy,
- communication,
- lessons learned,
- policy hardening.
Required evidence:
kubectl get pod <pod> -n <namespace> -o wide
kubectl get pod <pod> -n <namespace> -o yaml
kubectl describe pod <pod> -n <namespace>
kubectl logs <pod> -n <namespace> --all-containers
kubectl logs <pod> -n <namespace> --all-containers --previous
kubectl get sa,role,rolebinding -n <namespace>
kubectl auth can-i get secrets --as system:serviceaccount:<namespace>:<serviceaccount> -n <namespace>
kubectl get events -n <namespace> --sort-by=.metadata.creationTimestamp
Also document when a Pod may be deleted immediately and when it should first be isolated for evidence reasons.
9. Grading
| Area | Points | Expectation |
|---|---|---|
| Security questions | 15 | Attack surfaces, controls and risk effects correctly classified |
| Threat model and RBAC audit | 20 | Assets, trust boundaries, effective permissions and escalation paths understood |
| Pod, workload and network hardening | 20 | SecurityContext, Pod Security, ServiceAccount token and NetworkPolicies implemented correctly |
| Supply chain and Admission | 15 | Image, digest, scan, SBOM, signature and policy enforcement evaluated |
| Secrets, detection and compliance | 15 | Secret flow, runtime signals and evidence findings are operationally useful |
| Incident response | 10 | Triage, isolation, evidence, rotation, rebuild and lessons learned are complete |
| Documentation and cleanup | 5 | Submission is reproducible, safe and cleanly scoped |
| Total | 100 |
10. Knockout Criteria
The assessment fails regardless of point score if:
- real Secrets, customer data or production contexts are used,
- destructive actions are performed outside the lab,
- a production-like workload is allowed to run
privilegedwithout documented exception, - Secret read permissions are accepted without technical need,
- incident evidence is destroyed before basic capture,
- the candidate cannot explain why Base64 is not encryption,
- no stop criteria for production are defined.
11. Examiner Checklist
- Threat model separates API, node, workload, network, Secrets and supply chain.
kubectl auth can-ievidence exists for both ServiceAccounts.- Token automount is disabled for a workload without API need.
- Pod Security Restricted is labelled and unsafe Pod rejection is documented.
- Hardened Deployment contains non-root, seccomp, dropped capabilities and read-only root filesystem.
- NetworkPolicies include default deny, DNS and application allowance.
- Supply-chain review covers registry, digest, scan, SBOM, signature and stop criteria.
- Admission policies have audit/warn/enforce mode, exceptions and rollback path.
- Secrets review includes RBAC, mount, rotation, backups and leak response.
- Runtime detection and compliance evidence are actionable.
- Incident runbook covers triage, isolation, evidence, rotation, rebuild and policy improvement.