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
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?
AAuthorization, then authentication, then admission control
BAdmission control, then authentication, then authorization
CAuthentication, then authorization, then admission control
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.
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?
AOne ClusterRole, plus a ClusterRoleBinding for each team
BOne ClusterRole, plus a RoleBinding to it in each team's namespace
COne Role in the default namespace, referenced by RoleBindings in the teams' namespaces
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.
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?
ABase64-encode the password a second time before it is stored in the Secret
BMove the password into a ConfigMap and mark that ConfigMap immutable
CChange the Secret's type to Opaque so its data is handled as opaque bytes
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.
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?
ALabel the namespace pod-security.kubernetes.io/enforce=restricted
BLabel the namespace pod-security.kubernetes.io/warn=restricted
CCreate a PodSecurityPolicy that mirrors the Restricted profile's rules
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.
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?
APrivileged
BRestricted
CBaseline
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.
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?
AThe default ServiceAccount cannot be bound to a Role
BThe default ServiceAccount is reserved for control plane components
CThe default ServiceAccount is deleted when a Pod restarts
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.