Skip to content

Automation and Tooling: KCSA practice questions

Automation and tooling is the part of compliance that runs without a person in the loop. Writing a rule in a policy document does not stop anyone from creating a privileged pod; a control that is evaluated on every API request, or a scanner that inspects the cluster continuously, does.

By Ibrahim Yesilay · Published · Updated

Independent community practice, not affiliated with or endorsed by CNCF or The Linux Foundation.

What Automation and Tooling covers in KCSA

Automation and tooling is the part of compliance that runs without a person in the loop. Writing a rule in a policy document does not stop anyone from creating a privileged pod; a control that is evaluated on every API request, or a scanner that inspects the cluster continuously, does. The tools in this topic fit into a small number of roles, and recognizing the role matters more than memorizing product names.

The first role is preventive enforcement at admission. An admission controller intercepts a request to the API server after it has been authenticated and authorized but before the object is persisted. Mutating controllers run first and may change the request; validating controllers run second and may only accept or reject it. If any controller in either phase rejects the request, the whole request fails. Admission controllers act on create, update, delete and connect requests; they cannot block reads. Built-in plugins such as PodSecurity and ResourceQuota cover common rules, and MutatingAdmissionWebhook and ValidatingAdmissionWebhook let external policy engines take part.

Two policy engines appear often. OPA Gatekeeper describes itself as a validating and mutating webhook that enforces CRD-based policies executed by Open Policy Agent: a ConstraintTemplate defines a reusable policy and a Constraint instantiates it with parameters. Kyverno takes a Kubernetes-native approach in which policies are themselves Kubernetes resources written in YAML and CEL, so no new language is required, and they can be enforced as an admission controller, from a CLI scanner or at runtime. Kyverno rules can validate, mutate, generate or clean up resources, and can verify container images and their metadata for supply chain checks.

The second role is detective: finding what is already wrong. Admission only sees new requests, so objects created before a policy existed are not covered. Gatekeeper's audit function reports existing resources that violate a policy, and Kyverno reports results in the OpenReport format. Configuration benchmarks such as the CIS Kubernetes Benchmark are checked by scanners against node and control plane settings rather than individual objects.

The third role is runtime detection. Falco reads Linux kernel system call events, optionally adds other data sources through plugins, enriches events with container and Kubernetes metadata, and compares them with YAML rules; when a rule matches it raises an alert to stdout, a file, syslog, a program or an HTTP endpoint. Falco is a graduated CNCF project. This covers behavior that no manifest reveals, such as a shell spawned inside a running container.

Infrastructure as Code ties the roles together. When manifests and policies live in version control, every change is reviewed and repeatable, the same policy can be evaluated in a pipeline before anything reaches the cluster, and the history doubles as an audit trail.

Key points

  • Admission control runs after authentication and authorization; mutating controllers run before validating ones.
  • Admission controllers cannot block get, list or watch requests.
  • Gatekeeper uses ConstraintTemplate and Constraint custom resources; its audit reports existing violations.
  • Kyverno policies are Kubernetes resources written in YAML and CEL and can also verify image signatures.
  • Falco detects suspicious runtime behavior from kernel system call events and is a graduated CNCF project.

Three sample questions

9 KCSA questions on Automation and Tooling, 9 with explanations. How practice works

Question 1

Which tool is widely used to automate compliance checks against the CIS Kubernetes Benchmark?
  1. A.Nmap
  2. B.Kube-bench
  3. C.Grafana
  4. D.syslog-ng
  5. E.Bash scripts in CronJobs

Correct answer: B

Kube-bench is a specialized open-source tool designed to automate the assessment of Kubernetes clusters against the CIS Kubernetes Benchmark, which defines security best practices. Unlike generic tools such as Nmap or Grafana, Kube-bench runs checks that correspond directly to the CIS controls, providing detailed reports on compliance status. While Bash scripts can be used for automation, they lack the comprehensive and standardized checks that Kube-bench provides. Syslog-ng is a logging tool and unrelated to compliance scanning.

Sources: CIS Kubernetes Benchmark, Kube-bench GitHub Repository

Question 2

What is the primary purpose of Open Policy Agent (OPA) Gatekeeper in Kubernetes?
  1. A.To manage node scaling based on CPU usage
  2. B.To provide an integrated container registry
  3. C.To enforce policy-as-code by validating configurations during admission
  4. D.To offer a threat feed for container vulnerabilities
  5. E.To install an alternative container runtime in Kubernetes

Correct answer: C

OPA Gatekeeper is a validating admission controller that enforces policies defined as code during resource creation or updates in Kubernetes. It ensures compliance by preventing non-compliant resources from being admitted to the cluster. Incorrect options, such as managing node scaling or providing a container registry, are unrelated to OPA Gatekeeper's functionality. Similarly, it does not handle threat feeds or runtime installation.

Sources: Cloud Google - Pod Security Policies with Gatekeeper, Open Policy Agent Documentation - Kubernetes Admission Control

Question 3

What is Kyverno's primary function in a Kubernetes environment?
  1. A.A container scanning tool for malware detection
  2. B.A platform for automating cost optimizations
  3. C.An admission controller that enables writing and enforcing policies as Kubernetes resources
  4. D.An event streaming system for logs
  5. E.A vulnerability database maintained by CIS

Correct answer: C

Kyverno is a Kubernetes-native policy engine that functions as an admission controller. It allows administrators to define, validate, and enforce policies using Kubernetes Custom Resource Definitions (CRDs), making policy management declarative and integrated into the Kubernetes API. It is not a container scanning tool, cost optimization platform, log streaming system, or a vulnerability database. Its design simplifies policy enforcement without requiring external policy languages or frameworks.

Sources: Kyverno Official Documentation, Kubernetes Admission Controllers

Practice this topic

Focus mode keeps every question on Automation and Tooling until you leave it. 10 free guest answers, then a free account; no credit card.

Or open KCSA practice across all topics.

Sources

The explanation above was checked against these official documents.