KS

Free KS practice questions

10 questions from our KS practice tests, each with the correct answer and a written explanation. Read them with the answers shown, or switch to quiz mode and answer first.

Back to the KS practice exams

Question 1 of 10, Cluster and Control Plane Hardening. Choose 2.

A cluster runs the ingress-nginx controller with its validating admission webhook reachable from any Pod in the cluster. Following disclosure of critical vulnerabilities in that webhook that allowed unauthenticated code execution in the controller, which TWO actions reduce exposure? (Choose two.)

  1. ASet the webhook failurePolicy to Ignore so that broken requests are always allowed
  2. BRestrict network access to the admission webhook so only the API server can reach it Correct answer
  3. CUpgrade the controller to a patched release, and plan migration because ingress-nginx is retired Correct answer
  4. DMove the controller's TLS certificates into a ConfigMap so that they are easier to rotate
  5. EGive the controller's ServiceAccount the cluster-admin role so it can patch itself

Answer and explanation: Patching removes the known flaws, and because the ingress-nginx project has been retired, teams should plan to move to a maintained controller or Gateway API implementation. The webhook only needs to be reachable from the API server, so a NetworkPolicy limiting it removes the in-cluster attack path. Granting cluster-admin would increase the impact of a compromise. failurePolicy controls behaviour when the webhook is down, not who can reach it. Certificates belong in Secrets, and their storage has nothing to do with the flaw.

Question 2 of 10, Cluster and Control Plane Hardening

A security team installs a validating admission webhook that blocks images from unapproved registries and sets failurePolicy to Fail. During a node outage the webhook pods were evicted and the cluster could not recreate any pods, including the webhook itself and CoreDNS. Which change keeps the control fail-closed for application workloads while avoiding this deadlock?

  1. AExclude kube-system and the webhook's own namespace with a namespaceSelector and run the webhook with multiple replicas and a PodDisruptionBudget Correct answer
  2. BReplace the webhook with an audit policy at RequestResponse level so that violations are recorded instead of blocked at admission
  3. CRaise timeoutSeconds to 30 on the webhook configuration so that the API server waits much longer for the evicted webhook pods to be recreated
  4. DSwitch failurePolicy to Ignore for every namespace so that pods are always admitted whenever the webhook backend cannot be reached

Answer and explanation: Scoping the webhook away from the namespaces it depends on (and from system components) prevents a circular dependency, and redundancy plus a PodDisruptionBudget reduces the chance it is unavailable, while application namespaces stay fail-closed. Ignore everywhere makes the control fail open whenever an attacker can disrupt the webhook. A longer timeout cannot help when the backend pods do not exist, and it slows every request. Auditing records violations but no longer enforces the registry rule.

Question 3 of 10, Identity, Authentication and RBAC

An operator for a third-party database is installed and its ClusterRole includes the verbs 'bind' and 'escalate' on roles and clusterroles. The vendor says this is needed so the operator can create namespace Roles for the databases it manages. Which risk does this grant introduce?

  1. AThe operator can only bind roles that already exist, so the grant is safe as long as no new ClusterRoles are created
  2. BThe operator's ServiceAccount can create or bind roles with permissions it does not hold itself, including cluster-admin Correct answer
  3. CThe operator can impersonate any user, so its requests appear in audit logs under the impersonated user's name
  4. DThe operator can approve CertificateSigningRequests and therefore mint client certificates for the system:masters group

Answer and explanation: RBAC normally prevents a subject from creating or binding a role that grants more than it already has; escalate and bind are the verbs that lift that safeguard, so anyone controlling the operator's token can grant themselves cluster-admin. Scope them with resourceNames or to specific namespaces where possible. Impersonation needs the separate impersonate verb. CSR approval needs permissions on certificatesigningrequests/approval and signers. The bind verb allows binding powerful existing roles such as cluster-admin, so existing roles do not make it safe.

Question 4 of 10, Identity, Authentication and RBAC

An external Vault cluster authenticates Kubernetes workloads using the Kubernetes auth method. Pods send their projected ServiceAccount tokens to Vault. Security wants to make sure a token stolen from one of these Pods cannot be replayed against the Kubernetes API server. What should be configured?

  1. AStore the Vault token in a Kubernetes Secret and mount that instead of the ServiceAccount token in the Pod
  2. BRequest the projected token with a Vault-specific audience and configure Vault to require that audience Correct answer
  3. CSet the token's expirationSeconds to 24 hours so that a stolen token stays valid for less time than before
  4. DGive the ServiceAccount no RBAC permissions, because Vault validates the token with its own signing key

Answer and explanation: A projected token can carry a dedicated audience; the API server rejects tokens whose audience is not its own, and Vault can insist on its own audience, so a token stolen in transit to Vault is useless against the API. A 24-hour lifetime is longer than the typical default and only reduces exposure, it does not stop replay. Storing a long-lived Vault token in a Secret creates a new static credential. Vault normally verifies tokens via the TokenReview API or the cluster's public keys; having no RBAC does not limit what the token proves.

Question 5 of 10, Workload Security and Pod Security

A namespace enforces the restricted Pod Security Standard. An SRE runs 'kubectl debug' to attach an ephemeral container with a profiling tool that needs SYS_PTRACE to a production Pod. What happens?

  1. AThe ephemeral container is admitted, but the kubelet silently drops SYS_PTRACE when it starts the container
  2. BThe whole Pod is evicted, because adding a privileged ephemeral container violates the namespace policy
  3. CThe ephemeral container is rejected, because Pod Security Admission also evaluates ephemeral containers Correct answer
  4. DThe ephemeral container is admitted, because Pod Security Admission only evaluates the Pod at creation

Answer and explanation: Updates to the ephemeralcontainers subresource are checked by Pod Security Admission, and adding SYS_PTRACE violates restricted, so the request is denied; teams need a debugging profile compatible with the namespace level or a separate break-glass process. PSA does not ignore later additions to the Pod. The kubelet does not silently strip capabilities. Admission rejects the request; it does not evict existing Pods.

Question 6 of 10, Workload Security and Pod Security

One team asks to set the sysctl net.ipv4.ip_local_port_range in its Pods, and another team asks for net.core.somaxconn. Both namespaces enforce baseline Pod Security and the kubelets use default settings. How should the platform team handle these requests?

  1. AReject both, because baseline Pod Security blocks every sysctl that appears in a Pod's securityContext
  2. BAllow the first, which is in the safe set; the second needs allowed-unsafe-sysctls on dedicated, isolated nodes Correct answer
  3. CAllow both, because every sysctl set in a Pod spec is namespaced to that Pod and can never affect other workloads
  4. DAllow both only when the Pods also run as privileged, because sysctls can only be set in privileged mode

Answer and explanation: net.ipv4.ip_local_port_range is in the kubelet's safe sysctl set, which baseline permits, while net.core.somaxconn is not in that set and is rejected by the kubelet unless explicitly enabled with allowed-unsafe-sysctls, ideally only on dedicated tainted nodes. Not every sysctl is isolated, which is why the safe list exists. Baseline does allow safe sysctls. Privileged mode is not needed to set sysctls and would be excessive.

Question 7 of 10, Network Security and Segmentation

A platform team needs to guarantee that, in every namespace now and in the future, traffic to the cluster's ingress controller namespace is always allowed and traffic to the database subnet is always denied, even if a namespace owner writes permissive NetworkPolicies. Which approach fits?

  1. AAn Istio AuthorizationPolicy in istio-system that denies all traffic to the database subnet for workloads that have sidecars injected
  2. BCluster-scoped policies from the CNI, such as Calico GlobalNetworkPolicy or CiliumClusterwideNetworkPolicy, evaluated before namespace policies Correct answer
  3. CA default-deny NetworkPolicy in every namespace plus a Git review requirement for any NetworkPolicy changes that namespace owners submit
  4. DA NetworkPolicy in the ingress controller namespace that allows all ingress, plus one in the database namespace that denies all egress

Answer and explanation: Standard NetworkPolicy is namespaced and purely additive, so namespace owners can always open more; cluster-scoped, tiered policies from the CNI let administrators set rules that namespace policies cannot override. Review processes depend on people and do not cover new namespaces automatically. Policies in two namespaces do not prevent other namespaces' egress to the database subnet. A mesh policy only covers meshed workloads and external subnets need egress controls at the network layer.

Question 8 of 10, Software Supply Chain Security

A CI system builds and pushes images using a long-lived registry password stored as a CI variable. Security wants to remove that password while keeping automated pushes. What is the BEST approach?

  1. AGrant the CI runner node's instance role admin rights on all registries so that no credentials are needed
  2. BFederate the CI job's OIDC token with cloud IAM to get short-lived registry credentials for each run Correct answer
  3. CStore the registry password in a Kubernetes Secret and mount it into the CI runner Pods for each build
  4. DEncrypt the CI variable with a project-specific key and rotate the registry password manually each quarter

Answer and explanation: OIDC federation lets each pipeline run exchange its identity token for short-lived, scoped credentials, so there is no static password to leak. Encrypting and rotating still leaves a long-lived secret in between rotations. Admin rights on all registries for the node role violate least privilege and are shared by every job on that node. Moving the password into a Secret keeps the same static credential.

Question 9 of 10, Software Supply Chain Security

An application team adds open-source dependencies freely. The security team wants a quick, automated signal of how well maintained and secured each upstream project is before it is adopted. Which tool provides this?

  1. AFalco, which observes how the dependency behaves in production containers and assigns a risk score
  2. BOpenSSF Scorecard, which checks practices like branch protection, code review and pinning Correct answer
  3. CCosign, which reports whether a project's maintainers have signed every commit in the repository
  4. Dkube-bench, which scores each upstream project against the CIS Kubernetes Benchmark controls

Answer and explanation: OpenSSF Scorecard runs automated checks on a project's repository practices and produces a score, which helps decide whether a dependency is trustworthy. kube-bench audits cluster configuration, not projects. Cosign signs and verifies artefacts and does not assess maintainer practices. Falco detects runtime behaviour after deployment, which is too late for an adoption decision.

Question 10 of 10, Runtime Detection and Incident Response

Investigators suspect that a compromised node has a malicious static Pod defined on disk. Why would deleting the mirror Pod with kubectl not remove it?

  1. AStatic Pods are protected by a finalizer that only the cluster's original installer account can remove
  2. BStatic Pods are recreated by the DaemonSet controller whenever their mirror objects are deleted
  3. CStatic Pods are run by the kubelet from its manifest directory, and the API object is only a mirror Correct answer
  4. DStatic Pods are stored only in etcd, and kubectl cannot delete objects that lack an owner reference

Answer and explanation: The kubelet creates static Pods from files in its staticPodPath and publishes a read-only mirror Pod to the API; the container keeps running until the manifest file is removed from the node, which is why static Pods are a persistence technique on compromised nodes. There is no special finalizer. DaemonSets do not manage static Pods. Static Pods are defined on disk, not only in etcd.