Courseiva

CCNA Kubernetes Security Fundamentals Questions

72 questions · Kubernetes Security Fundamentals · All types, answers revealed

1
Multi-Selecthard

Which TWO mechanisms help secure Kubernetes Secrets against unauthorized access or exposure?

Select 2 answers
A.Granting cluster-admin to all application service accounts
B.Enabling encryption at rest using KMS or AES-CBC providers
C.Storing secrets in plaintext ConfigMaps for easier auditing
D.Disabling the Kubernetes audit log
E.Applying strict RBAC least-privilege roles to limit secret reading
AnswersB, E

Encrypts secret data in etcd.

Why this answer

Encryption at rest in etcd and strict RBAC least privilege are key mechanisms for protecting secrets.

2
Multi-Selecteasy

Which TWO tools or built-in Kubernetes features are used to secure container privileges and behaviors?

Select 2 answers
A.Pod Security Standards
B.PersistentVolumeClaim
C.SecurityContext
D.HorizontalPodAutoscaler
E.IngressController
AnswersA, C

Defines security profiles for pods.

Why this answer

Pod Security Standards and security contexts are core mechanisms for securing container privileges.

3
MCQeasy

An administrator needs to restrict access so that a specific ServiceAccount in the production namespace can only list pods, but cannot delete or modify them. Which core Kubernetes API resource should be configured to achieve this using RBAC?

A.ValidatingWebhookConfiguration
B.ClusterRole combined with a ClusterRoleBinding
C.PodSecurityPolicy
D.Role combined with a RoleBinding
AnswerD

A Role and RoleBinding limit permissions to a single namespace, perfect for restricting a specific ServiceAccount.

Why this answer

A Role defines permissions within a particular namespace. By binding a Role to a ServiceAccount via a RoleBinding, permissions are restricted strictly to that namespace.

4
Multi-Selectmedium

Which THREE fields are required when defining an egress rule in a Kubernetes NetworkPolicy?

Select 3 answers
A.egress list block
B.storageClassName for volume attachment
C.policyTypes containing 'Egress'
D.nodeSelector for worker placement
E.to block specifying destination matchers
AnswersA, C, E

The egress array defines outgoing rules.

Why this answer

Egress rules contain ports, to/ipBlock/etc., but the policy itself must include 'policyTypes' containing 'Egress', and the rules themselves specify destinations ('to') and optional ports.

5
Multi-Selecteasy

Which THREE methods can be used to inject Kubernetes Secrets into a running pod?

Select 3 answers
A.Injected as environment variables
B.Compiled directly into the container image binary
C.Mounted as files inside a volume
D.Injected via projected volumes
E.Injected through kernel sysctl parameters
AnswersA, C, D

Secrets can populate container environment variables.

Why this answer

Secrets can be injected into pods via environment variables, environment variables from secret keys, or mounted as files in volumes.

6
MCQmedium

By default, how are Kubernetes Secrets stored in etcd when created without additional encryption-at-rest configurations?

A.Hashed using SHA-256 with a random salt
B.Encrypted using the node's TPM chip
C.Encrypted using AES-256 automatically
D.Encoded in Base64 plaintext
AnswerD

Base64 is an encoding mechanism, not encryption; secrets are stored in etcd encoded in Base64.

Why this answer

By default, Kubernetes Secrets are stored encoded in Base64 plaintext within etcd, meaning anyone with etcd access can decode them.

7
Multi-Selectmedium

Which THREE of the following are official Pod Security Standard enforcement levels recognized by Kubernetes?

Select 3 answers
A.baseline
B.isolated
C.privileged
D.restricted
E.secure
AnswersA, C, D

Baseline prevents known privilege escalations.

Why this answer

The three official levels defined by Kubernetes Pod Security Standards are privileged, baseline, and restricted.

8
Multi-Selecteasy

Which TWO actions can be performed using Kubernetes RBAC rules?

Select 2 answers
A.Granting permission to create deployments cluster-wide
B.Encrypting secret values stored in etcd
C.Allocating storage capacity for PersistentVolumes
D.Enforcing Pod Security Standards on namespaces
E.Granting permission to read ConfigMaps in a namespace
AnswersA, E

ClusterRoles control cluster-wide resource creation.

Why this answer

RBAC rules define API groups, resources, and verbs to control permissions.

9
MCQhard

You want to ensure that a newly created Role in namespace 'finance' cannot be modified or deleted by regular developers who have edit permissions. Which RBAC feature or design prevents unauthorized privilege escalation through Role manipulation?

A.Enabling Pod Security Standards on the finance namespace.
B.Setting the Role resource to immutable via 'immutable: true'.
C.A mandatory MutatingWebhookConfiguration that strips administrative verbs.
D.The API server's built-in privilege escalation prevention check, which blocks users from granting permissions they do not hold.
AnswerD

Users cannot assign permissions via Roles or RoleBindings unless they already possess those exact permissions themselves.

Why this answer

Kubernetes has built-in authorization checks (RBAC privilege escalation prevention) that prevent users from creating or editing roles/rolebindings with permissions they do not themselves possess.

10
Multi-Selecthard

When configuring Pod Security Standards on a namespace, which THREE security restrictions are enforced by the 'restricted' profile that are NOT enforced by the 'baseline' profile? (Choose THREE)

Select 3 answers
A.Restricting volume types to a safe subset (e.g., configMap, secret, emptyDir).
B.Disallowing escalation of privilege (allowPrivilegeEscalation: false).
C.Requiring containers to run as a non-root user (runAsNonRoot: true).
D.Disallowing privileged containers.
E.Prohibiting hostPort usage entirely.
AnswersA, B, C

Restricted limits volume types significantly more than baseline to prevent host access.

Why this answer

The restricted profile adds requirements such as running as a non-root user, preventing escalation of privileges, and restricting allowed volume types.

11
Multi-Selectmedium

Which THREE fields are required when defining a standard Kubernetes NetworkPolicy resource? (Choose THREE)

Select 3 answers
A.metadata
B.securityContext
C.kind (set to NetworkPolicy)
D.imagePullSecrets
E.apiVersion
AnswersA, C, E

Metadata including name and namespace is required.

Why this answer

A NetworkPolicy requires apiVersion, kind, metadata, and spec containing at least podSelector.

12
MCQeasy

You need to isolate a database pod so that only pods with the label 'tier=frontend' within the same namespace can connect to it on port 5432. Which NetworkPolicy resource configuration achieves this?

A.A NetworkPolicy with an ingress rule specifying podSelector for 'tier=frontend' and port 5432.
B.A PodSecurityPolicy enforcing frontend network access.
C.A ServiceMesh AuthorizationPolicy restricting namespace-level routes.
D.A NetworkPolicy with an egress rule allowing frontend pods to reach the database.
AnswerA

This accurately restricts incoming traffic to only authorized frontend pods on the database port.

Why this answer

A NetworkPolicy targeting the database pods with 'podSelector' and defining an 'ingress' rule allowing traffic from pods matching 'tier=frontend' on port 5432.

13
MCQeasy

A security engineer wants to ensure that a pod cannot escalate its privileges to gain root access on the node. Which securityContext setting should be configured to prevent privilege escalation?

A.runAsNonRoot: false
B.allowPrivilegeEscalation: false
C.hostNetwork: true
D.privileged: true
AnswerB

This directly prevents processes from gaining additional privileges, such as through setuid/setgid binaries.

Why this answer

Setting allowPrivilegeEscalation: false in the container's securityContext ensures that a process cannot gain more privileges than its parent process (e.g., via setuid binaries).

14
MCQeasy

An administrator needs to store sensitive database credentials securely so that they can be mounted as environment variables inside a specific pod. Which Kubernetes object is designed for this purpose?

A.ResourceQuota
B.PersistentVolume
C.ConfigMap
D.Secret
AnswerD

Secrets are intended for sensitive configuration data.

Why this answer

Secret objects store sensitive data such as passwords, tokens, and keys.

15
MCQeasy

What is the purpose of the Pod Security Standards 'baseline' profile?

A.To disable all security controls and permit unrestricted container execution.
B.To automatically encrypt all container environment variables.
C.To enforce the highest level of security, restricting pods to hardened sandbox environments.
D.To prevent known privilege escalations while maintaining broad compatibility for standard applications.
AnswerD

Baseline strikes a balance between security hardening and application compatibility.

Why this answer

The baseline profile prevents known privilege escalations while allowing the default (minimally specified) pod configuration.

16
MCQhard

You want to write a NetworkPolicy that allows backend pods to communicate with an external database located outside the cluster at IP address '203.0.113.50'. Which NetworkPolicy section must you configure?

A.ingress with a namespaceSelector matching the external network
B.ExternalName service mapped to an egress policy
C.egress with an ipBlock matching '203.0.113.50/32'
D.policyTypes set to ["Ingress"] with externalIPs
AnswerC

Egress rules control outgoing traffic, and ipBlock allows specifying external CIDR ranges.

Why this answer

To control traffic leaving the pod to external IPs or destinations outside the pod network, you must configure 'egress' rules with a 'ipBlock'.

17
Multi-Selecthard

Which TWO statements accurately describe how Kubernetes admission controllers function? (Choose TWO)

Select 2 answers
A.Admission controllers run on the kubelet before container creation on the worker node.
B.Validating admission controllers can reject incoming requests but cannot modify the object content.
C.Admission controllers replace the need for RBAC authentication.
D.If any validating webhook fails and its failurePolicy is 'Ignore', the API server stops processing further webhooks.
E.Mutating admission controllers execute before validating admission controllers and can modify object fields.
AnswersB, E

Validation phase ensures compliance without mutating the payload.

Why this answer

Admission controllers execute in two phases (mutating then validating) and can reject or modify requests before persistence.

18
MCQeasy

An administrator needs to grant read-only access to Pods specifically within the 'development' namespace to a new user. Which RBAC configuration correctly scopes this permission?

A.Create a ClusterRole for Pod read access and bind it to the user using a RoleBinding in the 'development' namespace.
B.Annotate the user's ServiceAccount with namespace read permissions.
C.Create a Role for Pod read access in the 'development' namespace and bind it to the user using a RoleBinding in the same namespace.
D.Create a Role for Pod read access and bind it globally using a ClusterRoleBinding.
AnswerC

A Role combined with a RoleBinding in the target namespace properly restricts permissions to that namespace only.

Why this answer

A Role must be used instead of a ClusterRole when scoping permissions to a single namespace. The Role must be bound via a RoleBinding within that same namespace.

19
MCQeasy

You need to restrict network traffic so that only pods with the label 'tier=frontend' can communicate with pods labeled 'tier=backend' in the same namespace. Which Kubernetes resource should you create?

A.NetworkPolicy
B.Ingress
C.FirewallRule
D.Service
AnswerA

NetworkPolicies control ingress and egress traffic for pods.

Why this answer

A NetworkPolicy is used to restrict pod-to-pod and network traffic at the IP/port/label level.

20
Multi-Selecthard

Which THREE components are involved when an external client authenticates to the Kubernetes API server using OpenID Connect (OIDC)? (Choose THREE)

Select 3 answers
A.The OIDC Identity Provider (IdP) issuing ID tokens.
B.The CoreDNS server resolving the OIDC provider domain.
C.The client (such as kubectl) presenting the OIDC token in the Authorization header.
D.The Kubelet running on worker nodes.
E.The kube-apiserver configured with OIDC issuer flags.
AnswersA, C, E

The IdP authenticates the user and provides the JSON Web Token (JWT).

Why this answer

OIDC authentication involves the client (e.g. kubectl), the OIDC identity provider, and the kube-apiserver.

21
Multi-Selectmedium

Which TWO of the following statements are true regarding Kubernetes Secrets and their security posture by default?

Select 2 answers
A.Mounting a Secret as an environment variable can expose the secret value in container logs or crash dumps.
B.Secrets are strongly encrypted at rest using AES-256 encryption by default in etcd.
C.RBAC can be used to restrict which users and ServiceAccounts can read Secrets within a namespace.
D.Secrets automatically expire and rotate every 30 days unless explicitly disabled.
E.Secrets encoded in base64 provide cryptographic security comparable to robust symmetric encryption.
AnswersA, C

Environment variables are visible via process listings and diagnostic dumps, making volume mounts generally more secure for secrets.

Why this answer

Kubernetes Secrets are base64 encoded (not encrypted) by default in etcd, and access to them can be controlled via RBAC.

22
Multi-Selectmedium

Which THREE options represent valid ways to supply sensitive data to a container using Kubernetes native features? (Choose THREE)

Select 3 answers
A.Placing the Secret inside a persistent volume formatted with LUKS encryption.
B.Mounting the Secret as a volume in the Pod specification.
C.Querying the Kubernetes API server directly from the container using a ServiceAccount with proper RBAC.
D.Embedding the Secret plaintext string in the container image build args.
E.Injecting Secret keys as environment variables.
AnswersB, C, E

Secrets can be mounted as files in a volume.

Why this answer

Secrets can be mounted as volumes, exposed as environment variables, or accessed via the Kubernetes API directly.

23
Multi-Selecteasy

Which TWO of the following are valid Kubernetes RBAC rule subjects that can be bound to roles or cluster roles?

Select 2 answers
A.Secret
B.User
C.Namespace
D.ServiceAccount
E.PersistentVolume
AnswersB, D

Users represent human users authenticated to the cluster.

Why this answer

Kubernetes RBAC supports three primary subjects: User, Group, and ServiceAccount.

24
MCQeasy

You are auditing a cluster and find a pod that mounts the host's root filesystem directly into the container. Which Pod Security Standard rule does this violate?

A.It is permitted under all standards provided the container runs as a non-root user.
B.It violates both baseline and restricted standards by using a hostPath volume.
C.It is fully compliant with the restricted standard as long as 'readOnly: true' is set.
D.It only violates the restricted standard; baseline permits hostPath mounts.
AnswerB

hostPath volumes provide direct access to the underlying node filesystem and are blocked by default in hardened standards.

Why this answer

Mounting host paths (hostPath volumes) is prohibited by both the baseline and restricted Pod Security Standards because it allows container escape.

25
MCQhard

You have configured a NetworkPolicy with an egress rule targeting a specific CIDR block. However, DNS resolution for external domain names fails from within the pods selected by this policy. What is the most likely cause?

A.NetworkPolicies automatically disable CoreDNS across the entire namespace.
B.DNS packets are rejected because they do not contain IP block headers.
C.The external domain name does not have a corresponding Service object.
D.Outgoing DNS traffic on UDP/TCP port 53 to the cluster DNS server was blocked by the default-deny egress behavior.
AnswerD

Egress policies block DNS queries to CoreDNS/kube-dns unless port 53 egress is explicitly permitted.

Why this answer

When an egress policy is applied, all outgoing traffic (including UDP/TCP port 53 to cluster DNS servers) is blocked unless explicitly allowed by an egress rule.

26
MCQmedium

A security auditor notices that a deployment running in the 'production' namespace is violating the Restricted Pod Security Standard because containers are running as root. How can you enforce compliance using Pod Security Admission?

A.Label the 'production' namespace with 'pod-security.kubernetes.io/enforce=restricted'.
B.Create a NetworkPolicy that blocks root user communication.
C.Enable the SecurityContextDeny legacy admission controller.
D.Update the kube-apiserver flags to globally block non-restricted pods without namespace labels.
AnswerA

Namespace labels are the correct mechanism to configure the Pod Security Admission controller to enforce standards.

Why this answer

Applying the 'pod-security.kubernetes.io/enforce: restricted' label to the namespace enforces the restricted Pod Security Standard for all newly created pods.

27
MCQhard

An application pod requires access to the Kubernetes API to list other pods. To follow secure practices, you create a dedicated ServiceAccount and bind a custom Role to it. How should you configure the Pod specification to prevent the default service account token from being automatically mounted?

A.Delete the 'default' ServiceAccount in the namespace.
B.Set 'automountServiceAccountToken: false' in the Pod specification.
C.Configure the Pod securityContext with 'readOnlyRootFilesystem: true'.
D.Add a deny NetworkPolicy blocking egress to the Kubernetes API service IP.
AnswerB

This setting stops the default token from being mounted into the pod's filesystem.

Why this answer

Setting 'automountServiceAccountToken: false' on either the ServiceAccount or the Pod specification prevents the automatic mounting of the token, reducing the blast radius if compromised.

28
MCQeasy

A cluster administrator needs to grant read-only access to pods within the 'development' namespace using Kubernetes RBAC. Which resource kind should be used to define the permissions?

A.SecurityContextConstraints
B.Role
C.PodSecurityPolicy
D.ClusterRole
AnswerB

Role is used to define permissions within a single namespace.

Why this answer

A Role defines permissions within a specific namespace, whereas a ClusterRole defines cluster-scoped permissions. Since the requirement is restricted to the 'development' namespace, a Role is the correct resource.

29
MCQhard

An external identity provider (OIDC) is integrated with your Kubernetes cluster. You want to restrict a group named 'contractors' so they can only view pods in the 'staging' namespace. Which configuration correctly maps this requirement?

A.A ClusterRole granting pod read access bound via a RoleBinding in the 'staging' namespace to the subject kind 'Group' with name 'contractors'.
B.A Namespace-scoped ServiceAccount configured with an OIDC JWT issuer URL.
C.A Role in the 'staging' namespace bound via a ClusterRoleBinding to the 'contractors' group.
D.An OIDC webhook configuration in the kube-apiserver specifying namespace boundaries.
AnswerA

Binding a ClusterRole via a RoleBinding scopes the permissions strictly to the target namespace for the specified OIDC group.

Why this answer

A ClusterRole providing read access to pods, combined with a RoleBinding in the 'staging' namespace referencing the OIDC group 'contractors'.

30
MCQeasy

An application running in a pod needs to securely consume a database password without storing it in plaintext within the container image or deployment manifest. Which native Kubernetes resource is best suited for storing this sensitive key-value data?

A.PersistentVolumeClaim
B.ResourceQuota
C.Secret
D.ConfigMap
AnswerC

Secrets are intended for sensitive data and provide mechanisms to mount them as files or environment variables inside pods.

Why this answer

Kubernetes Secrets are designed specifically to store and manage sensitive information such as passwords, OAuth tokens, and ssh keys.

31
Multi-Selectmedium

Which TWO of the following actions are considered best practices for securing Kubernetes Secrets? (Choose TWO)

Select 2 answers
A.Store database passwords in plaintext ConfigMaps for easier application ingestion.
B.Enable encryption at rest for Secret resources in etcd.
C.Rely on base64 encoding as the primary encryption mechanism for sensitive data.
D.Strictly limit RBAC permissions so that only necessary users and service accounts can read Secrets.
E.Mount Secrets as writable volumes so applications can update their own credentials.
AnswersB, D

Encrypting Secrets at rest protects them if the underlying etcd data store is compromised.

Why this answer

Enabling encryption at rest in etcd and restricting RBAC access to Secrets are core practices. Base64 encoding is not security, and putting secrets in ConfigMaps is insecure.

32
MCQhard

When configuring a MutatingWebhookConfiguration, you notice that mutating webhooks are executed before validating webhooks. Why is this execution order critical for security and consistency?

A.It ensures that validating webhooks evaluate the final, mutated state of the object rather than the original input.
B.It prevents mutating webhooks from timing out while waiting for validation checks.
C.Mutating webhooks require encryption keys generated during the validation phase.
D.It allows validating webhooks to override any changes made by mutating webhooks if security violations occur.
AnswerA

Validating webhooks need to check the exact object configuration that will be persisted, which includes any changes made by mutating webhooks.

Why this answer

Mutating webhooks can alter the object (e.g., injecting sidecars or default security contexts). Validating webhooks must run after mutation so they validate the final, resulting object state.

33
MCQhard

Your cluster uses the Pod Security admission controller with the 'restricted' profile enforced. A legacy application pod fails to start because it requires running as root (runAsNonRoot: false). How should you handle this securely without disabling the standard?

A.Disable the Pod Security admission controller entirely across the cluster.
B.Configure the Pod Security admission configuration file on the control plane to exempt the specific ServiceAccount or namespace from the restricted check.
C.Set the namespace enforce level to 'privileged' permanently.
D.Mount the host socket inside the pod to bypass user namespace restrictions.
AnswerB

The Pod Security admission plugin supports exemptions for specific usernames, namespaces, and runtime classes via its configuration file.

Why this answer

To accommodate specific pods that need exceptions while maintaining an overall enforce profile, you can use the 'audit' or 'warn' modes for specific versions or adjust the namespace labels, or use an exception mechanism if supported, but best practice is fixing the application or using a targeted bypass/exception if allowed, or applying an explicit exception configuration in the Pod Security admission configuration file.

34
MCQhard

You are reviewing admission webhook configurations and notice that timeoutSeconds is set to 3 seconds for a critical validation webhook. If the webhook server takes 4 seconds to respond, what does the API server do when failurePolicy is 'Ignore'?

A.It quarantines the pod in a Pending state.
B.It rejects the API request immediately.
C.It retries the webhook request indefinitely until it responds.
D.It allows the API request to proceed as if the webhook succeeded.
AnswerD

An 'Ignore' failure policy allows requests to proceed despite webhook errors or timeouts.

Why this answer

When failurePolicy is 'Ignore', a timeout or error reaching the webhook results in the API server ignoring the failure and allowing the request to proceed.

35
MCQeasy

A security engineer wants to apply Pod Security Standards globally across an entire namespace using the modern built-in admission mechanism. Which approach should be used?

A.Create a MutatingWebhookConfiguration that injects security contexts into every pod spec.
B.Apply labels such as 'pod-security.kubernetes.io/enforce=restricted' to the namespace metadata.
C.Modify the kubelet configuration file on every worker node to enable restricted mode.
D.Deploy a custom PodSecurityPolicy object targeting the namespace selector.
AnswerB

Namespace labels are the standard method for configuring the Pod Security admission controller.

Why this answer

The Pod Security admission controller uses namespace labels (such as 'pod-security.kubernetes.io/enforce') to apply enforcement levels like privileged, baseline, or restricted.

36
Multi-Selecthard

Which TWO components are involved in configuring and processing admission webhooks in a Kubernetes cluster?

Select 2 answers
A.kube-apiserver
B.ValidatingWebhookConfiguration
C.kube-proxy
D.kubelet
E.etcd daemon
AnswersA, B

The API server invokes admission webhooks during request processing.

Why this answer

Admission webhooks are configured via MutatingWebhookConfiguration or ValidatingWebhookConfiguration objects, and processed by the kube-apiserver.

37
Multi-Selecthard

An administrator is hardening a Kubernetes cluster against container breakout vulnerabilities and node compromise. Which THREE security practices should be implemented?

Select 3 answers
A.Run all containers as the root user (UID 0) to ensure smooth file permission handling.
B.Configure readOnlyRootFilesystem: true to prevent malicious writes to the container's root file system.
C.Drop all default Linux capabilities (ALL) and explicitly add back only those strictly required by the application.
D.Enable hostNetwork and hostPID on all production pods to improve debugging visibility.
E.Enforce the Pod Security Standards "restricted" profile via namespace labeling.
AnswersB, C, E

A read-only root filesystem prevents attackers from dropping binaries or modifying system files inside the container.

Why this answer

Hardening involves dropping unnecessary Linux capabilities, enforcing read-only root filesystems where applicable, and avoiding sharing host namespaces like hostNetwork or hostPID.

38
MCQmedium

An application pod requires read access to secrets in the 'production' namespace. You need to bind a pre-existing ClusterRole named 'secret-reader' to a service account named 'app-sa' in that namespace. Which RBAC resource accomplishes this?

A.ClusterRoleBinding referencing the Role 'secret-reader'
B.NamespaceRoleBinding referencing the ClusterRole
C.RoleBinding referencing the ClusterRole 'secret-reader'
D.ServiceAccountBinding referencing the ClusterRole
AnswerC

A RoleBinding in the target namespace can bind to a ClusterRole, granting access scoped to that namespace.

Why this answer

A RoleBinding can reference a ClusterRole to grant permissions defined in that ClusterRole to subjects within the specific namespace of the RoleBinding.

39
MCQmedium

A CI/CD pipeline service account needs permission to create Deployments and Services across multiple namespaces, but should not have cluster-admin privileges. What is the most secure way to grant these permissions?

A.Define a ClusterRole with the required verbs and resources, then create a RoleBinding for that ClusterRole in each target namespace.
B.Place the service account in the kube-system namespace.
C.Grant the service account permissions at the node level using kubeconfig overrides.
D.Create a ClusterRoleBinding linking the default cluster-admin ClusterRole to the service account.
AnswerA

This allows a single ClusterRole definition to be reused across multiple namespaces via namespaced RoleBindings, limiting scope.

Why this answer

Create a ClusterRole with the necessary rules for Deployments and Services, and bind it to the service account in each target namespace using RoleBindings.

40
MCQhard

You are troubleshooting a custom controller that fails to read ConfigMaps in the 'kube-system' namespace despite having a ClusterRole bound via a ClusterRoleBinding. What is the most likely reason for this failure?

A.The ClusterRole lacks the required verbs ('get', 'list', 'watch') or resources ('configmaps') for that API group.
B.ClusterRoleBindings cannot be used with ConfigMaps.
C.ClusterRoleBindings are automatically disabled in 'kube-system'.
D.ConfigMaps in 'kube-system' can only be accessed using ServiceAccounts named 'default'.
AnswerA

RBAC permissions are explicitly defined by resource and verb combinations; if 'configmaps' or verbs are missing, access is denied.

Why this answer

While ClusterRoleBindings grant cluster-wide access, certain system namespaces or sensitive resources may be protected or restricted, or the ClusterRole might not include the correct API groups/resources. However, a common security hardening practice or misconfiguration involves incorrect rule definitions, or the verbs/resources mismatch. Specifically, let's look at the options: missing verbs, or standard RBAC behavior where ClusterRoleBindings apply everywhere unless restricted.

Wait, let's examine option A.

41
MCQmedium

You are deploying a ValidatingWebhookConfiguration to inspect incoming pod creations. What happens if the webhook fails and the 'failurePolicy' in the webhook configuration is set to 'Fail'?

A.The API request is allowed to proceed without validation.
B.The API request is rejected.
C.The pod is created in a suspended state until the webhook recovers.
D.The kube-apiserver restarts automatically.
AnswerB

A failurePolicy of 'Fail' means webhook errors result in request rejection (fail closed).

Why this answer

When failurePolicy is set to 'Fail', any error or timeout reaching the external webhook causes the API server to reject the API request.

42
MCQmedium

An application pod needs to access the Kubernetes API server securely. How does Kubernetes authenticate the pod by default when it communicates with the API server?

A.Using static username and password credentials stored in environment variables.
B.Using a ServiceAccount bearer token mounted inside the pod's filesystem.
C.Using mutual TLS (mTLS) client certificates generated by the kubelet on startup.
D.Using SSH keys stored in the pod's root directory.
AnswerB

Pods authenticate to the API server via the projected ServiceAccount token.

Why this answer

Kubernetes automatically mounts a ServiceAccount token into the pod's filesystem, which the pod sends as a Bearer token to authenticate with the API server.

43
MCQeasy

An administrator wishes to inspect which admission controllers are currently enabled in a running Kubernetes cluster. Where is this typically configured in a stacked control plane?

A.In the kube-apiserver static pod manifest file under '/etc/kubernetes/manifests/kube-apiserver.yaml'.
B.In the CoreDNS deployment spec.
C.In the kubelet configuration file on each worker node.
D.In the cluster-wide ConfigMap named 'kube-system/cluster-admission'.
AnswerA

The API server configuration file defines active admission plugins.

Why this answer

Admission controllers are configured via the '--enable-admission-plugins' flag on the kube-apiserver static pod manifest.

44
Multi-Selecthard

Which THREE features are enforced or verified by the Kubernetes 'restricted' Pod Security Standard profile?

Select 3 answers
A.Allows containers to run in privileged mode if requested
B.Requires dropping all capabilities except NET_BIND_SERVICE
C.Prohibits privilege escalation (allowPrivilegeEscalation: false)
D.Permits mounting the host network namespace without restriction
E.Enforces running as non-root (runAsNonRoot: true)
AnswersB, C, E

Restricted profile restricts Linux capabilities.

Why this answer

The restricted profile enforces running as non-root, dropping all capabilities (or keeping only NET_BIND_SERVICE), and prohibiting privilege escalation.

45
Multi-Selectmedium

Which TWO mechanisms are used by Kubernetes admission controllers to enforce security policies during the API request lifecycle?

Select 2 answers
A.Validating admission webhooks can reject object definitions that violate security standards.
B.kubelet automatically runs security audits on all container images prior to pull.
C.etcd executes consensus validation scripts to strip unauthorized RBAC rules.
D.Mutating admission webhooks can alter request payloads to enforce defaults like securityContext constraints.
E.kube-proxy inspects network payloads at Layer 7 to block unauthorized API requests.
AnswersA, D

Validating webhooks inspect the final object state and return a pass/fail decision to the API server.

Why this answer

Mutating admission controllers can modify incoming objects before they are persisted, and Validating admission controllers can evaluate and reject non-compliant requests.

46
MCQmedium

An application pod needs to mount a Secret as environment variables. Which section of the Pod manifest should be configured to achieve this securely?

A.Using 'env' with 'valueFrom.secretKeyRef' or 'envFrom' with 'secretRef' in the container specification.
B.Using 'volumeMounts' pointing to a PersistentVolumeClaim bound to the Secret.
C.Adding the Secret name directly to the container imagePullSecrets field.
D.Declaring the Secret in the container securityContext block.
AnswerA

These are the correct fields for injecting Secret data as environment variables into containers.

Why this answer

Environment variables can be populated from Secrets using 'envFrom' or 'env' with 'valueFrom.secretKeyRef'.

47
Multi-Selecteasy

Which TWO components are core parts of the Kubernetes authorization architecture? (Choose TWO)

Select 2 answers
A.Webhook Authorization
B.Role-Based Access Control (RBAC)
C.CoreDNS service discovery
D.Kubelet node daemon
E.etcd key-value datastore
AnswersA, B

Kubernetes supports external authorization via webhook token/request evaluation.

Why this answer

RBAC and Webhook are authorization modes evaluated by the API server after authentication.

48
MCQhard

A security engineer configures a ValidatingWebhookConfiguration to intercept pod creations. The webhook service goes down due to a network partition. What happens to incoming pod creation requests by default if the webhook 'failurePolicy' is set to 'Fail'?

A.The kubelet automatically bypasses the webhook and starts the container locally.
B.The API server allows the pod creation request and logs a warning.
C.The API server rejects the pod creation request with an error.
D.The API server queues the request until the webhook service recovers.
AnswerC

A 'Fail' policy treats webhook unavailability as a validation failure, blocking the request.

Why this answer

When failurePolicy is set to 'Fail', if the webhook encounters an error or is unreachable, the API server rejects the request.

49
Multi-Selectmedium

Which THREE conditions must be met for a RoleBinding to successfully grant permissions to a ServiceAccount?

Select 3 answers
A.The kubelet must restart to load the binding.
B.The RoleBinding and Role must reside in the same namespace (if using a Role).
C.The RoleBinding must reference an existing Role or ClusterRole.
D.The ServiceAccount must have cluster-admin privileges.
E.The ServiceAccount subject must be correctly specified with its name and namespace.
AnswersB, C, E

Namespaced RoleBindings and Roles must be in the same namespace.

Why this answer

A RoleBinding requires a valid Role/ClusterRole reference, valid subjects (ServiceAccount), and must exist in the correct namespace (for RoleBindings).

50
MCQhard

An administrator wishes to create a NetworkPolicy that allows incoming traffic from any pod in any namespace, provided those pods have the label 'environment=production'. How should the NetworkPolicy 'ingress' rule be structured?

A.Specify an ingress 'from' entry containing a 'namespaceSelector' matching the desired namespaces and a 'podSelector' matching 'environment=production'.
B.Add the production label to the target pod's metadata and reference it in the egress block.
C.Specify only a 'podSelector' with 'environment=production' without any namespace selector.
D.Use a cluster-wide ClusterNetworkPolicy resource with global label matching.
AnswerA

Combining namespaceSelector and podSelector in an ingress rule allows cross-namespace traffic filtering based on labels.

Why this answer

To select pods across namespaces, the 'from' array must use 'namespaceSelector' combined with 'podSelector'.

51
MCQmedium

An enterprise cluster requires that all incoming NetworkPolicies must default to denying all traffic unless explicitly allowed. A developer creates a namespace but forgets to apply any policies. What is the default behavior of Kubernetes regarding inter-pod traffic within a namespace when no NetworkPolicies are present?

A.Only traffic originating from the kube-system namespace is allowed.
B.All traffic between pods is allowed by default.
C.Traffic is allowed only if the pods share the same node.
D.All traffic between pods is denied by default.
AnswerB

Kubernetes network model is non-isolated by default until a NetworkPolicy selects a pod.

Why this answer

By default, Kubernetes namespaces are non-isolated (allow-all). All pods can communicate with all other pods unless a NetworkPolicy explicitly restricts traffic.

52
MCQmedium

A cluster operator is enforcing the Pod Security Standards "restricted" profile across a namespace. A developer attempts to deploy a container running as root (runAsUser: 0). What will happen during the admission phase?

A.The pod will be created, but the kubelet will override the user ID to 65534 at runtime.
B.The pod will start successfully in audit mode, generating a warning event in the API server logs.
C.The PodSecurity admission controller will reject the pod creation request.
D.The container will drop all Linux capabilities and proceed with deployment.
AnswerC

The restricted profile forbids containers running as root, causing the Pod Security admission controller to deny the request.

Why this answer

The restricted Pod Security Standard explicitly prohibits containers from running as root and enforces a non-root user. The request will be rejected by the Pod Security admission controller.

53
MCQeasy

What is the primary function of the 'automountServiceAccountToken: false' setting in a Pod specification?

A.It deletes the ServiceAccount object from the cluster when the pod terminates.
B.It prevents the pod from communicating with the Kubernetes API server entirely.
C.It disables RBAC authorization checks for the pod.
D.It prevents the ServiceAccount API token from being automatically mounted inside the pod.
AnswerD

This setting disables token auto-mounting for enhanced security.

Why this answer

Setting automountServiceAccountToken to false prevents the automatic mounting of the ServiceAccount API token into the pod's filesystem, reducing the attack surface if the pod is compromised.

54
MCQeasy

A developer accidentally committed plain-text database passwords into a public Git repository. The password was stored in a Kubernetes Secret manifest. What immediate remediation step should be taken regarding the Secret?

A.Apply a DenyAll NetworkPolicy to the namespace.
B.Delete the Secret object and restart all cluster nodes.
C.Rotate the credential in the underlying database, then update the Kubernetes Secret with the new value.
D.Change the Secret manifest encoding from base64 to hex format.
AnswerC

Since the secret was exposed, the credential itself is compromised and must be rotated at the source.

Why this answer

Rotate the compromised password in the database immediately, then update the Kubernetes Secret with the new password.

55
MCQhard

You need to ensure that a Secret containing database credentials cannot be read by anyone except the database application controller, even if they have broad RBAC read permissions in the namespace. Which feature should you consider?

A.Enable the ValidatingAdmissionPolicy to inspect the user's decryption key.
B.Store the credentials in an external secrets manager and use an Operator to inject them directly into pod environment variables, avoiding the creation of Kubernetes Secret objects entirely.
C.Set the secret data encoding to AES-256 within the manifest metadata.
D.Apply a Role restricting Secret viewing by adding a label selector to the RoleBinding.
AnswerB

Avoiding Kubernetes Secret objects eliminates the risk of users with namespace Secret read permissions accessing the credentials.

Why this answer

Standard Kubernetes RBAC is resource-based and does not support cell-level or secret-value level restrictions natively within a namespace once read access to secrets is granted. However, migrating to an external secrets manager or using advanced admission control can restrict access. Within native Kubernetes, RBAC allows reading secrets if 'get' or 'list' is granted on 'secrets'.

To strictly isolate secrets, external secret operators injecting secrets via environment variables or volume mounts without granting direct secret API access is standard practice.

56
MCQmedium

An administrator wants to ensure that no container in a specific namespace runs with a root User ID (UID 0). Which security context setting should be enforced?

A.privileged: false
B.readOnlyRootFilesystem: true
C.runAsNonRoot: true
D.allowPrivilegeEscalation: false
AnswerC

runAsNonRoot ensures containers fail to start if they run as root.

Why this answer

Setting 'runAsNonRoot: true' in the security context forces the container runtime to reject containers that attempt to run as UID 0.

57
Multi-Selecthard

Which TWO statements are true regarding Kubernetes NetworkPolicy default behaviors?

Select 2 answers
A.NetworkPolicies automatically block all traffic across all namespaces upon cluster installation.
B.By default, all pods in a cluster are non-isolated and accept traffic from any source.
C.When a NetworkPolicy selects a pod and specifies ingress rules, unallowed ingress traffic is blocked.
D.Egress traffic is blocked by default even if no NetworkPolicy is created.
E.NetworkPolicies apply to cluster nodes rather than individual pods.
AnswersB, C

Cluster networking is open by default until policies are applied.

Why this answer

By default, pods are non-isolated (all traffic allowed). When a NetworkPolicy selects pods and specifies ingress/egress, those specific directions become deny-by-default.

58
MCQhard

An auditor notices that default ServiceAccounts in newly created namespaces are automatically mounting their API tokens into pods, creating an unnecessary attack surface. How can an administrator permanently disable automatic token mounting for all new service accounts in a specific namespace?

A.By applying a PodSecurityPolicy with spec.hostNetwork set to false.
B.By editing the kube-apiserver manifest to include the --disable-service-account-tokens flag.
C.By setting automountServiceAccountToken: false on the default ServiceAccount within that namespace.
D.By creating a LimitRange that restricts secret volume mounts.
AnswerC

Pods referencing that ServiceAccount will no longer automatically mount the token unless explicitly overridden in the pod spec.

Why this answer

Setting automountServiceAccountToken: false on the ServiceAccount resource prevents the token from being automatically mounted into pods using that service account.

59
MCQeasy

Which RBAC verb allows a user to delete an existing resource in a Kubernetes namespace?

A.delete
B.remove
C.purge
D.destroy
AnswerA

The 'delete' verb grants permission to remove resources.

Why this answer

The 'delete' verb specifically authorizes removing resources.

60
MCQmedium

Under the Pod Security Standards, a developer attempts to deploy a pod with 'privileged: true' in a namespace labeled with 'pod-security.kubernetes.io/enforce=baseline'. What will happen?

A.The admission controller will reject the pod creation request with an error.
B.The pod will run in a restricted sandbox environment automatically.
C.The pod will be created successfully, but a warning will be logged in the audit log.
D.The kubelet will automatically strip the 'privileged: true' setting and run the pod safely.
AnswerA

Privileged mode violates the baseline policy, causing the admission controller to deny the request.

Why this answer

The 'baseline' profile prohibits privileged containers. The admission controller will reject the pod creation request.

61
Multi-Selecteasy

Which TWO entities can be assigned RBAC permissions in a Kubernetes cluster? (Choose TWO)

Select 2 answers
A.ConfigMap
B.Namespace
C.ServiceAccount
D.PersistentVolume
E.User
AnswersC, E

ServiceAccounts are standard non-human identities in Kubernetes.

Why this answer

RBAC bindings can be assigned to Users, Groups, and ServiceAccounts.

62
MCQmedium

An administrator wants to prevent users from creating pods that mount the host network ('hostNetwork: true'). Which tool or feature is best suited to enforce this restriction natively across the cluster?

A.ResourceQuota limiting network interfaces
B.Pod Security admission controller with baseline or restricted profile
C.RBAC ClusterRole restricting pod creation
D.NetworkPolicy with a deny-all rule
AnswerB

Both baseline and restricted Pod Security profiles disallow hostNetwork.

Why this answer

The Pod Security admission controller's 'restricted' or 'baseline' profile automatically blocks pods that set 'hostNetwork: true'.

63
MCQhard

You want to enable encryption at rest for Kubernetes Secrets in your cluster using an external KMS (Key Management Service) provider. Which component on the control plane reads the EncryptionConfiguration file and handles this encryption?

A.kube-controller-manager
B.kube-apiserver
C.kubelet
D.etcd daemon directly
AnswerB

The API server handles encryption at rest and integrates with the EncryptionConfiguration resource and KMS plugins.

Why this answer

The kube-apiserver is responsible for interacting with etcd and applies the EncryptionConfiguration to encrypt secrets before writing them to etcd and decrypting them when read.

64
MCQmedium

A cluster administrator needs to intercept and reject any resource creation requests that do not include a mandatory security-context label. Which admission controller type should be implemented?

A.MutatingAdmissionWebhook
B.ServiceAccount
C.ValidatingAdmissionWebhook
D.NamespaceLifecycle
AnswerC

Validating admission webhooks inspect incoming requests and can reject them if they fail specific organizational policies.

Why this answer

Validating admission webhooks are executed after all mutation phases are complete and can accept or reject requests based on custom validation logic.

65
MCQeasy

You are troubleshooting a pod that fails to start because it attempts to run a container with privileges. The cluster enforces the 'baseline' Pod Security Standard. Which container configuration will cause the Pod Security Admission controller to reject the pod?

A.Mounting an emptyDir volume into the container.
B.Omitting the 'runAsUser' field, allowing the container to run as UID 0 by default.
C.Setting 'securityContext.privileged: true' on the container.
D.Adding the 'NET_BIND_SERVICE' capability to the container.
AnswerC

Privileged containers are explicitly prohibited by both baseline and restricted Pod Security Standards.

Why this answer

The baseline standard disallows privileged containers. Setting 'securityContext.privileged: true' violates the baseline standard and will be rejected.

66
MCQeasy

Which of the following describes a recommended security practice when managing Kubernetes Secrets?

A.Use ConfigMaps for passwords and Secrets for plain text configuration.
B.Store secret values in plain text inside public Git repositories for easy collaboration.
C.Limit RBAC access so that only necessary users and service accounts can read secrets.
D.Disable authentication on the Kubernetes API server to simplify secret retrieval.
AnswerC

Principle of least privilege applies strongly to secrets access.

Why this answer

Restricting RBAC permissions to secrets ensures that only authorized users and workloads can read sensitive data.

67
MCQmedium

Your team is storing sensitive database credentials in Kubernetes Secrets. A security review reveals that base64 encoding does not provide encryption at rest. What mechanism should you enable to ensure Secrets are encrypted when stored in etcd?

A.Apply a MutatingWebhookConfiguration to automatically hash passwords using bcrypt.
B.Enable TLS encryption for all intra-cluster communication using kubeadm configuration.
C.Configure an EncryptionConfiguration file and reference it via the '--encryption-provider-config' flag on the kube-apiserver.
D.Set the secret type to 'kubernetes.io/encrypted-secret'.
AnswerC

This is the native Kubernetes mechanism for encrypting Secret resources at rest in etcd.

Why this answer

Enabling EncryptionConfiguration with providers like aescbc or kms ensures that API server encrypts secret data before writing it to etcd.

68
MCQmedium

You need to grant a monitoring tool permission to perform HTTP GET requests against health endpoints across all pods in the cluster, but no other API access. How should you define the RBAC rules?

A.Assign the tool to the system:masters group.
B.Grant cluster-admin access and restrict requests using a kube-proxy firewall rule.
C.Create a ClusterRole with API groups [''] and resources ['pods/status'].
D.Create a ClusterRole with verbs ['get'] and nonResourceURLs ['/healthz', '/readyz'].
AnswerD

Non-resource URLs grant access to cluster endpoints that do not correspond to API resource objects.

Why this answer

Non-resource URLs like '/healthz' or pod subresources like '/pods/{name}/proxy' are specified using 'nonResourceURLs' or subresource permissions in rules.

69
Multi-Selectmedium

Which TWO types of selectors can be used within a Kubernetes NetworkPolicy ingress rule to specify allowed traffic sources?

Select 2 answers
A.serviceSelector
B.namespaceSelector
C.ingressSelector
D.nodeSelector
E.podSelector
AnswersB, E

namespaceSelector matches entire source namespaces based on labels.

Why this answer

Ingress 'from' blocks support podSelector and namespaceSelector to match traffic sources.

70
MCQmedium

An auditor notices that a secret is mounted as a volume in a pod. Where is this secret stored on the worker node filesystem by default?

A.In an encrypted SQLite database on the node's root partition.
B.In plaintext files inside /etc/kubernetes/secrets on the node's hard drive.
C.Inside the container image layer cache.
D.In tmpfs (memory), ensuring it is not written to non-volatile disk storage.
AnswerD

Secret volumes are backed by tmpfs so they reside in RAM.

Why this answer

Kubernetes secrets mounted as volumes are stored in tmpfs (RAM-backed memory) on the worker node, preventing them from being written to persistent disk storage.

71
MCQmedium

You have deployed a NetworkPolicy in a namespace that selects backend pods, defining an 'ingress' rule with a 'from' block. No other NetworkPolicies exist in the namespace. What is the default behavior for traffic from pods not matched by the 'from' selector?

A.All ingress traffic remains allowed by default.
B.The policy fails to apply because an egress rule must also be defined.
C.Only traffic from other namespaces is denied; same-namespace traffic is still allowed.
D.All ingress traffic from unmatched pods is denied.
AnswerD

NetworkPolicies are additive and restrictive; defining an ingress rule makes the targeted pods default-deny for unspecified sources.

Why this answer

When a NetworkPolicy selects a pod and defines an ingress section, all ingress traffic not explicitly allowed by the policy is denied by default.

72
MCQhard

You are auditing a Kubernetes cluster and notice that a specific ServiceAccount has been granted the 'impersonate' verb on users. What security risk does this permission introduce?

A.It automatically generates valid X.509 client certificates for cluster nodes.
B.It allows the pod to intercept network traffic of other pods on the same node.
C.It permits the ServiceAccount to bypass the Kubernetes API server and write directly to etcd.
D.It allows the ServiceAccount to act as any user or service account, leading to privilege escalation.
AnswerD

Impersonation grants the ability to assume other identities, bypassing standard RBAC restrictions if high-privilege identities can be assumed.

Why this answer

The 'impersonate' verb allows the holder to act as other users or service accounts, effectively escalating their privileges to match any identity they can impersonate.

Ready to test yourself?

Try a timed practice session using only Kubernetes Security Fundamentals questions.