Skip to content

KCNA · Domain 2: Container Orchestration · 28% of the exam

Task 2.2: Security

Authentication, authorization with RBAC, admission control, service accounts, Secrets and encryption at rest, security contexts, Pod Security Standards and Pod Security Admission, and the cloud native security lifecycle from develop to runtime.

Study it

  • Authentication, RBAC, service accounts and admission

    Lesson coming

  • Secrets, security contexts and Pod Security Standards

    Partly covered by: ConfigMaps, Secrets & Env

Sample questions

Try each one before opening the answer. Every option is explained, with the CNCF documentation page that proves it.

Question 1 · choose 1

A request to create a Pod is rejected by a policy webhook after the API server has already confirmed who sent it and that the sender may create Pods. In which order does the API server run these checks?

  1. AAuthorization, then authentication, then admission control
  2. BAdmission control, then authentication, then authorization
  3. CAuthentication, then authorization, then admission control
  4. DAuthentication, then admission control, then authorization
Show the answer and why
  • AAuthorization, then authentication, then admission control

    Incorrect

    Authorization decides what an identified user may do, so it needs the result of authentication first.

  • BAdmission control, then authentication, then authorization

    Incorrect

    Admission controllers act on requests that are already authenticated and authorized.

  • CAuthentication, then authorization, then admission control

    Correct

    The request is authenticated first, then authorized for the action, and only then passed to admission controllers such as webhooks.

  • DAuthentication, then admission control, then authorization

    Incorrect

    Admission comes last; a request that is not authorized never reaches it.

Every API request goes through authentication, authorization and then admission control; the webhook in the scenario is an admission controller.

Question 2 · choose 1

Ten teams each have their own namespace. The administrator wants one definition of "read Pods and their logs" and wants each team to get it only inside its own namespace. What should be created?

  1. AOne ClusterRole, plus a ClusterRoleBinding for each team
  2. BOne ClusterRole, plus a RoleBinding to it in each team's namespace
  3. COne Role in the default namespace, referenced by RoleBindings in the teams' namespaces
  4. DA ServiceAccount per team bound to the cluster-admin ClusterRole
Show the answer and why
  • AOne ClusterRole, plus a ClusterRoleBinding for each team

    Incorrect

    A ClusterRoleBinding grants the permissions across all namespaces, which is far more than each team should get.

  • BOne ClusterRole, plus a RoleBinding to it in each team's namespace

    Correct

    A RoleBinding can reference a ClusterRole and grants its permissions only within the RoleBinding's namespace, so one definition serves every team.

  • COne Role in the default namespace, referenced by RoleBindings in the teams' namespaces

    Incorrect

    A RoleBinding can reference a Role only in its own namespace, so a Role in default cannot be reused elsewhere.

  • DA ServiceAccount per team bound to the cluster-admin ClusterRole

    Incorrect

    cluster-admin grants every action everywhere; it breaks least privilege.

Define common permissions once as a ClusterRole and bind them per namespace with RoleBindings to keep each grant inside its namespace.

Question 3 · choose 1

An auditor finds that anyone who can read the cluster's etcd data can read the application's database password stored in a Secret. What addresses this finding?

  1. ABase64-encode the password a second time before it is stored in the Secret
  2. BMove the password into a ConfigMap and mark that ConfigMap immutable
  3. CChange the Secret's type to Opaque so its data is handled as opaque bytes
  4. DEnable encryption at rest for Secrets and restrict Secret reads with RBAC
Show the answer and why
  • ABase64-encode the password a second time before it is stored in the Secret

    Incorrect

    Base64 is an encoding that anyone can reverse; doing it twice protects nothing.

  • BMove the password into a ConfigMap and mark that ConfigMap immutable

    Incorrect

    Immutable stops changes, not reading, and ConfigMaps are meant for non-confidential data.

  • CChange the Secret's type to Opaque so its data is handled as opaque bytes

    Incorrect

    The type describes the Secret's structure; Opaque Secrets are stored the same way as any other type.

  • DEnable encryption at rest for Secrets and restrict Secret reads with RBAC

    Correct

    Secrets are stored unencrypted in etcd by default and their values are only base64 encoded. Encryption at rest protects the stored data; RBAC limits API access.

Base64 is not encryption. Protecting Secrets means encrypting them at rest in etcd and granting read access to Secrets sparingly.

Question 4 · choose 1

The security team wants the API server to reject any new Pod in the namespace payments that does not meet the Restricted Pod Security Standard. Which configuration does this with built-in features?

  1. ALabel the namespace pod-security.kubernetes.io/enforce=restricted
  2. BLabel the namespace pod-security.kubernetes.io/warn=restricted
  3. CCreate a PodSecurityPolicy that mirrors the Restricted profile's rules
  4. DApply a default-deny NetworkPolicy in the namespace
Show the answer and why
  • ALabel the namespace pod-security.kubernetes.io/enforce=restricted

    Correct

    The built-in Pod Security admission controller reads this label and rejects Pods that violate the Restricted profile.

  • BLabel the namespace pod-security.kubernetes.io/warn=restricted

    Incorrect

    warn mode shows the user a warning for violations but still allows the Pod.

  • CCreate a PodSecurityPolicy that mirrors the Restricted profile's rules

    Incorrect

    PodSecurityPolicy was removed from Kubernetes in v1.25; Pod Security Admission replaced it.

  • DApply a default-deny NetworkPolicy in the namespace

    Incorrect

    NetworkPolicy controls traffic between Pods; it does not judge a Pod's security settings.

Pod Security Admission applies the Pod Security Standards per namespace through labels; enforce mode rejects violating Pods, while audit and warn only report them.

Question 5 · choose 1

A monitoring tool needs read access to Node objects. Which RBAC objects grant that?

  1. AA Role in kube-system for nodes with a RoleBinding
  2. BA ClusterRole for nodes with a RoleBinding in default
  3. CA ClusterRole for nodes with a ClusterRoleBinding
  4. DA Role for nodes in each of the namespaces
Show the answer and why
  • AA Role in kube-system for nodes with a RoleBinding

    Incorrect

    Roles are namespaced, and Nodes are not in any namespace.

  • BA ClusterRole for nodes with a RoleBinding in default

    Incorrect

    Nodes are not in any namespace, so a namespaced binding cannot reach them.

  • CA ClusterRole for nodes with a ClusterRoleBinding

    Correct

    Nodes are cluster-scoped, so the permission is defined in a ClusterRole and granted with a ClusterRoleBinding.

  • DA Role for nodes in each of the namespaces

    Incorrect

    Namespaced Roles cannot cover cluster-scoped resources such as Nodes.

Cluster-scoped resources like Nodes need cluster-wide RBAC objects.

Question 6 · choose 1

A team wants the least restrictive Pod Security Standard that still prevents known privilege escalations, so that most ordinary workloads run without changes. Which profile fits?

  1. APrivileged
  2. BRestricted
  3. CBaseline
  4. DDefault
Show the answer and why
  • APrivileged

    Incorrect

    Privileged is unrestricted and allows known privilege escalations.

  • BRestricted

    Incorrect

    Restricted is heavily restricted and follows hardening best practices, so more workloads need changes.

  • CBaseline

    Correct

    Baseline is minimally restrictive, prevents known privilege escalations and allows the default Pod configuration.

  • DDefault

    Incorrect

    Default is not one of the Pod Security Standards.

The three standards are Privileged, Baseline and Restricted, from open to strict.

Question 7 · choose 1

An app needs RBAC permissions to read ConfigMaps. An engineer suggests granting them to the namespace's default ServiceAccount. Why is a dedicated ServiceAccount for the app better?

  1. AThe default ServiceAccount cannot be bound to a Role
  2. BThe default ServiceAccount is reserved for control plane components
  3. CThe default ServiceAccount is deleted when a Pod restarts
  4. DPods that name no ServiceAccount get default, and its rights
Show the answer and why
  • AThe default ServiceAccount cannot be bound to a Role

    Incorrect

    The default ServiceAccount can be bound like any other; that is the danger.

  • BThe default ServiceAccount is reserved for control plane components

    Incorrect

    Every namespace's Pods use it unless told otherwise.

  • CThe default ServiceAccount is deleted when a Pod restarts

    Incorrect

    It exists for the life of the namespace.

  • DPods that name no ServiceAccount get default, and its rights

    Correct

    Kubernetes assigns the default ServiceAccount to Pods that name none, so permissions on it reach all of them.

Give each workload its own ServiceAccount with only the permissions it needs, instead of widening the default one.

Question 8 · choose 1

During an RBAC review, which verb deserves particular care because it lets a user act with the rights of other users or ServiceAccounts?

  1. Aimpersonate
  2. Bwatch
  3. Cpatch
  4. Ddeletecollection
Show the answer and why
  • Aimpersonate

    Correct

    The impersonate verb lets users impersonate and gain the rights of other users in the cluster.

  • Bwatch

    Incorrect

    watch streams changes to resources the user may already read.

  • Cpatch

    Incorrect

    patch modifies objects the user is allowed to change; it does not borrow another identity.

  • Ddeletecollection

    Incorrect

    This deletes many objects at once but keeps the user's own identity.

RBAC good practices flag impersonate, escalate and bind as verbs that can lead to privilege escalation.

Practise domain 2 →Practise all domains →