Kubernetes Pod Security Interview Questions: k8s Security Practice Quiz
Reviewed by Mark Dickie · Last updated
6 questions on this page you can answer and see marked on the spot. Go to the first one
Kubernetes pod security is the set of controls that decide which privileges, host access, volumes and user IDs a pod's containers may use. Interviewers look for the built-in Pod Security Admission levels (privileged, baseline and restricted), how a namespace label enforces them, and the securityContext fields that meet each level. Expect to explain why PodSecurityPolicy was removed in Kubernetes 1.25 and what replaced it. Strong answers also name the gap: admission checks the pod spec when a pod is created, not what a process does after it starts.
Which pod security settings come up in Kubernetes interviews?
| Setting | Where it is set | What it blocks |
|---|---|---|
privileged: true | container securityContext | Grants all Linux capabilities and host device access |
hostPath volumes | pod volumes | Mounts node directories, a common route out of the container |
hostNetwork, hostPID, hostIPC | pod spec | Shares the node's network, process or IPC namespace |
runAsNonRoot: true | pod or container securityContext | Stops containers that run as UID 0 from starting |
allowPrivilegeEscalation: false | container securityContext | Stops setuid binaries from gaining extra privileges |
seccompProfile.type: RuntimeDefault | pod or container securityContext | Applies the container runtime's default syscall filter |
How do I practice pod security on a real cluster?
- Create a namespace, label it
pod-security.kubernetes.io/enforce=restricted, then apply a pod withprivileged: trueand read the admission error. - Add
pod-security.kubernetes.io/warn=baselineto a namespace that already runs workloads, and note which pods the warning names before you enforce anything. - Take a pod that runs as root and change it until it passes
restricted: setrunAsNonRoot, dropALLcapabilities, setallowPrivilegeEscalationtofalse, and setseccompProfiletoRuntimeDefault(orLocalhost). - Mount a
hostPathvolume in a pod, then explain to an interviewer why namespace-level admission alone does not stop a compromised workload from using that mount.
Key facts
- Tarmac has 11 Kubernetes interview questions on this topic, 10 of them on this page, at difficulty 1–5 of 5.
- Tarmac tracked 1,603 job postings asking for Kubernetes in November 2026.
- Roles asking for Kubernetes advertise a median base salary of £77,000, across 605 job postings as of November 2026.
- Tarmac last reviewed these Kubernetes interview questions on 3 December 2026.
At a glance
| Questions | 10 shown · 11 in the bank |
|---|---|
| Difficulty | 1–5 of 5 |
| Formats | Multiple answer, Fill in the blank, True / false, Flashcard, Design exercise, Find the bug, Short answer, Multiple choice, Ordering |
What you'll review
- pod security
Practice questions
Try one before you open the answer. Pick an option and press Check; it's marked on the spot.
Kubernetes Pod Security Standards define a set of built-in policy levels that Pod Security Admission can apply to a namespace. Which of the following are official Pod Security Standards levels? (Select all that apply.)#
Options
Pick every one that applies.
Show answer
The Pod Security Standards have three levels: privileged, baseline and restricted. privileged places no restrictions on pods. baseline blocks known privilege escalations like host namespaces and privileged containers. restricted enforces hardening best practices such as running as non-root and dropping capabilities. Pod Security Admission uses these level names in namespace labels like pod-security.kubernetes.io/enforce.
The Pod Security Standards have exactly three levels. privileged places no restrictions on pods. baseline blocks known privilege escalations, such as host namespaces and privileged containers. restricted follows current pod-hardening best practices, such as running as non-root and dropping capabilities. hardened and permissive sound reasonable but are not levels; they are made up. Pod Security Admission accepts only privileged, baseline or restricted as values in its namespace labels.
Pod Security Admission defines three Pod Security Standards levels. From least to most restrictive, they are _____ (no restrictions at all), baseline (blocks known privilege escalations), and _____ (follows current pod-hardening best practices).#
Show answer
Pod Security Admission defines three Pod Security Standards levels. From least to most restrictive, they are **privileged** (no restrictions at all), baseline (blocks known privilege escalations), and **restricted** (follows current pod-hardening best practices).
The Pod Security Standards have three levels. privileged has no restrictions and is meant for trusted system workloads. baseline blocks known privilege escalations, such as host namespaces and privileged containers. restricted is the strictest level and requires hardening such as running as non-root, dropping all capabilities, and using a seccomp profile. You use these level names as values in namespace labels like pod-security.kubernetes.io/enforce.
In current Kubernetes versions (v1.25+), PodSecurityPolicy (PSP) has been removed, and the built-in Pod Security Admission controller is the replacement for enforcing Pod Security Standards.#
Options
Show answer
Yes. Kubernetes removed PodSecurityPolicy in v1.25 after deprecating it in v1.21. The built-in Pod Security Admission controller replaces it and became stable in the same release. Pod Security Admission applies the Privileged, Baseline and Restricted Pod Security Standards to each namespace, which you set with pod-security.kubernetes.io/* labels.
PodSecurityPolicy was deprecated in v1.21 and removed in v1.25. Pod Security Admission, a built-in admission controller that went stable in v1.25, replaces it. It enforces the Privileged, Baseline and Restricted Pod Security Standards, which you configure with namespace labels. So the statement is true.
What are the three Pod Security Standards profiles in Kubernetes, and what does each one roughly allow?#
Show answer
Privileged: no restrictions at all. Meant for trusted system and infrastructure workloads such as CNI plugins or storage drivers. Baseline: a minimal set of rules that blocks known privilege escalations. It forbids privileged containers, hostNetwork/hostPID/hostIPC, hostPath volumes, adding extra capabilities beyond the default set, and so on. Most ordinary apps run under it without changes. Restricted: hardened best practice. It includes everything in Baseline, and also requires runAsNonRoot, allowPrivilegeEscalation: false, dropping ALL capabilities (only NET_BIND_SERVICE may be added back), a RuntimeDefault or Localhost seccomp profile, and only a limited set of volume types.
The Pod Security Standards set out three cumulative policy levels, from loosest to strictest: Privileged, Baseline, and Restricted. Pod Security Admission enforces them per namespace through labels. To choose the right level for a namespace, you need to know what each profile allows and blocks.
Your team runs a stateless Node.js web API on Kubernetes (current version). Today the Deployment's pod spec has no securityContext, and the container image runs as root and writes temp files to /tmp. A security review asks you to harden the pod spec so it would pass the Pod Security Standards restricted profile and limit the damage if the app is compromised. Describe the pod- and container-level securityContext settings (plus any other spec changes) you would add, why each matters, and how you would keep the app working afterwards.#
Show answer
At pod level I'd set securityContext: {runAsNonRoot: true, runAsUser: 10001, runAsGroup: 10001, fsGroup: 10001, seccompProfile: {type: RuntimeDefault}}. I'd also update the Dockerfile with USER 10001 so the image doesn't depend on root. runAsNonRoot makes the kubelet refuse to start the container if it would run as UID 0, so an attacker who breaks out of the app doesn't get root. RuntimeDefault seccomp blocks dangerous syscalls such as kernel module or keyring calls, and the restricted profile requires it. At container level I'd set allowPrivilegeEscalation: false, which sets no_new_privs so setuid binaries can't raise privileges, and capabilities: {drop: ["ALL"]}, which removes things like NET_RAW and CHOWN. I'd also set readOnlyRootFilesystem: true so an attacker can't drop binaries or change the app's code. Because the app writes to /tmp, I'd add an emptyDir volume mounted at /tmp. I'd make the app listen on a high port such as 8080 because it can no longer bind to ports below 1024, and the Service would map port 80 to 8080. To roll this out, I'd first label the namespace with warn and audit set to restricted, or use a server-side dry run, and then test in staging before enforcing.
The restricted Pod Security Standard requires a non-root user, allowPrivilegeEscalation: false, dropping ALL capabilities, and a RuntimeDefault or Localhost seccomp profile. A read-only root filesystem isn't required, but it's standard hardening, and the emptyDir mount shows you understand what breaks when you add it. Each rubric criterion covers a separate control, so a strong answer has to name the actual settings and explain how the app keeps working.
Pod Security Admission (PSA) replaces RBAC as the mechanism for controlling which users can create Pods in a namespace.#
Options
Show answer
False. Pod Security Admission replaced PodSecurityPolicy (removed in Kubernetes 1.25), not RBAC. RBAC governs which users or ServiceAccounts can call which API verbs and resources, while PSA governs what security posture a Pod's spec must have to be admitted into a namespace — a user with full RBAC rights to create Pods can still be blocked by PSA if the Pod doesn't meet the namespace's level. Both mechanisms remain necessary and operate independently.
False. PSA replaced PodSecurityPolicy (removed in Kubernetes 1.25) — it did not replace RBAC. RBAC governs which identities can call which API verbs and resources (can this user or ServiceAccount create a Pod at all?); PSA governs what security posture a Pod's spec must have to be admitted into a namespace, checked regardless of who created it. A user with full RBAC rights to create Pods in a namespace can still be blocked by PSA if the Pod's securityContext doesn't meet the namespace's configured level. Both mechanisms remain necessary and operate independently — treating one as a substitute for the other leaves a real gap.
The payments namespace is labeled pod-security.kubernetes.io/enforce: restricted. Applying this Deployment fails with a PodSecurity admission error. Which part of the Pod template is the problem?#
apiVersion: apps/v1
kind: Deployment
metadata:
name: worker
namespace: payments
spec:
replicas: 2
selector:
matchLabels:
app: worker
template:
metadata:
labels:
app: worker
spec:
containers:
- name: worker
image: example/worker:3.1Options
Show answer
The container has no securityContext at all, so it fails restricted's requirements — runAsNonRoot: true, allowPrivilegeEscalation: false, dropped capabilities, and a RuntimeDefault/Localhost seccomp profile all default to unset or permissive
restricted is the strictest Pod Security Standard, and it's checked against the Pod template a Deployment produces. With no securityContext set anywhere, every restricted-only requirement fails at once: runAsNonRoot is unset (defaults to allowing root), allowPrivilegeEscalation is unset (defaults to true), no capabilities are dropped, and no seccomp profile is set. Any one of those alone would be enough to reject the Pod. replicas and namespace placement have nothing to do with PSA, and Deployments are a completely normal, supported workload type under Pod Security Admission — the check runs against the Pods they create.
How do you configure Pod Security Admission for a namespace, and what's the difference between its enforce, audit, and warn modes?#
Show answer
PSA is configured with labels on the Namespace object, not a separate policy resource — for example pod-security.kubernetes.io/enforce: restricted, optionally pinned to a specific standard version with pod-security.kubernetes.io/enforce-version: latest (or an explicit version). Each of the three modes can carry a different level and acts independently: enforce actually blocks Pod creation when a Pod violates the level, returning a Forbidden error; audit allows the Pod through but adds a violation annotation to the audit log; warn allows it through but returns a client-visible warning, e.g. shown by kubectl. A common rollout pattern is setting warn/audit at a stricter level first to see what would break, then flipping to enforce once workloads comply.
PSA has no separate policy CRD — it's entirely namespace labels. The three modes decouple 'what would this reject' from 'what does this actually reject,' which is what makes the audit/warn-first-then-enforce rollout pattern possible without breaking existing workloads blind.
A container spec sets capabilities.drop: ["ALL"], allowPrivilegeEscalation: false, and seccompProfile.type: RuntimeDefault, but does not set runAsNonRoot, so its image runs as UID 0. Under which Pod Security Admission level does this Pod get admitted?#
Options
Show answer
baseline admits this Pod, but restricted rejects it, because restricted additionally requires runAsNonRoot: true — a check baseline doesn't perform. The Pod already satisfies both levels' capability and seccomp rules by dropping all capabilities and using RuntimeDefault; running as root is the one gap only restricted catches.
This Pod already clears every baseline and restricted rule around capabilities and seccomp: dropping all capabilities and adding none back satisfies both levels' capability rules, and RuntimeDefault satisfies both levels' seccomp requirement. The one rule that's restricted-only is runAsNonRoot: true (with a non-zero runAsUser) — baseline never checks it. So baseline admits this Pod as-is, and restricted is the level that catches the root UID and rejects it. Conflating 'dropped all capabilities' with 'runs as non-root' is a common gap in an otherwise well-hardened spec.
A user runs kubectl apply to create a Pod in a namespace labeled pod-security.kubernetes.io/enforce: restricted. The cluster also has a mutating admission webhook that injects a sidecar container. Put the kube-apiserver's handling of this create request in order, from first to last.#
Put these in order
Show answer
A Pod create request goes through these steps in order: authentication, RBAC authorization, mutating admission (including sidecar-injecting webhooks), schema validation, PodSecurity validating admission, and finally persistence to etcd. Pod Security Admission runs in the validating phase, after mutation. Because of that, a sidecar injected by a webhook that breaks the namespace's enforced profile causes the whole Pod to be rejected.
The kube-apiserver authenticates the request first, then authorizes it. Only after that does the request enter the admission chain. Mutating admission always runs first, and this includes mutating webhooks such as a sidecar injector. Next the mutated object goes through schema validation. Then the validating admission phase runs, and the built-in PodSecurity plugin belongs to that phase. The object is written to etcd only after every admission check passes. This order has a practical security effect: PodSecurity checks the Pod after mutation. So if the injected sidecar breaks the restricted profile (for example, it lacks runAsNonRoot or does not drop all capabilities), the whole Pod is rejected, even though the user's original manifest was compliant.
Related interview questions
Job market
See kubernetes salaries and hiring demand from live job postings.
The other 1 question
This page shows 10 and marks what you pick. That's as far as a page can go. A free account opens the other 1 and keeps every answer. What you miss comes back until it's right: after a day, then at longer gaps.
Free · the whole bank · 100 answers per 30 days, each marked with written feedback