Skip to content

KCSA: Compliance and Security Frameworks

10% of the KCSA exam, 4 competencies. Back to the KCSA overview.

Each competency lists what to know and the official documentation to read, then a demo you can run. Demos run on the demo lab, a throwaway kind cluster on your own machine; set it up once before you start.

Know

  • Regulations (PCI DSS, HIPAA, GDPR) say what to protect; benchmarks such as the CIS Kubernetes Benchmark say how to configure it.

Read

Know

  • STRIDE and MITRE ATT&CK for containers describe what attackers do, so you can map controls to threats.

Read

Know

  • SBOMs, signed artifacts, and provenance attestations give evidence of what was deployed.

Read

Demo: Read the official SBOM of a Kubernetes release

  1. Kubernetes publishes an SPDX SBOM for every release. List the images it contains.

    Terminal window
    curl -Ls https://sbom.k8s.io/v1.37.2/release | grep 'SPDXID: SPDXRef-Package-registry.k8s.io' | head
    curl -Ls https://sbom.k8s.io/v1.37.2/release | grep -c '^PackageName:'

What you should see: The SBOM lists every package and image in the release. Compliance frameworks increasingly ask suppliers for exactly this: a machine-readable list you can scan for vulnerable components when the next CVE lands.

Know

  • Benchmarks and policies are checked by tools: kube-bench for CIS, policy engines for admission, scanners for images.

Read

Demo: A pre-merge gate with server-side dry run

  1. Create a namespace for this demo and make it the default for your context.

    Terminal window
    kubectl create namespace kcsa-gate
    kubectl config set-context --current --namespace=kcsa-gate
  2. Check manifests against the live cluster’s admission rules without changing anything.

    Terminal window
    kubectl label namespace kcsa-gate pod-security.kubernetes.io/enforce=restricted
    cat > candidate.yaml <<'EOF'
    apiVersion: apps/v1
    kind: Deployment
    metadata:
    name: candidate
    namespace: kcsa-gate
    spec:
    replicas: 1
    selector:
    matchLabels:
    app: candidate
    template:
    metadata:
    labels:
    app: candidate
    spec:
    containers:
    - name: app
    image: registry.k8s.io/e2e-test-images/agnhost:2.66.1
    args: ["netexec", "--http-port=8080"]
    EOF
    kubectl apply --dry-run=server -f candidate.yaml; echo "exit code $?"
    kubectl get deployments

What you should see: The dry run passes (exit code 0) but prints a PodSecurity warning: Deployments are admitted and only their pods are checked, so in a real apply the ReplicaSet would fail to create pods. A gate should treat warnings as failures (--warnings-as-errors) and check workloads with a policy engine, not only the API server’s answer.

Clean up:

Terminal window
rm -f candidate.yaml
kubectl config set-context --current --namespace=default
kubectl delete namespace kcsa-gate

Domain and competency names are from the CNCF KCSA curriculum (current curriculum (unversioned)), cncf/curriculum, licensed CC BY 4.0. Summaries, demos, and exercises are original to this site.