KCSA: Platform Security
16% of the KCSA exam, 7 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.
Supply Chain Security
Section titled “Supply Chain Security”Know
- Know what is in your images (SBOM), where they came from (provenance), and that they were not changed (signatures).
Read
Demo: use the CKS demo for “Secure your supply chain (permitted registries, sign and validate artifacts, etc.)”. It restricts which registries pods may use and verifies the signature of an official Kubernetes image with cosign.
Image Repository
Section titled “Image Repository”Know
- Use a private, authenticated registry and only allow images from approved registries through admission policy.
Read
Demo: Registry credentials attached to a service account
-
Create a namespace for this demo and make it the default for your context.
Terminal window kubectl create namespace kcsa-registrykubectl config set-context --current --namespace=kcsa-registry -
Create a pull secret and attach it to the namespace’s default service account.
Terminal window kubectl create secret docker-registry private-reg --docker-server=registry.example.invalid --docker-username=puller --docker-password=not-realkubectl patch serviceaccount default -p '{"imagePullSecrets":[{"name":"private-reg"}]}' -
Every new pod now carries the credential.
Terminal window kubectl run app --image=registry.example.invalid/team/app:1.0kubectl get pod app -o jsonpath='{.spec.imagePullSecrets}{"\n"}'sleep 15; kubectl describe pod app | sed -n '/Events:/,$p' | tail -4
What you should see: The pod spec has imagePullSecrets it didn’t ask for: the service account added it at admission. The pull fails because the registry doesn’t exist. Pull secrets are readable by anyone who can read Secrets in the namespace, so prefer short-lived registry tokens or node-level credential providers.
Clean up:
kubectl config set-context --current --namespace=defaultkubectl delete namespace kcsa-registryObservability
Section titled “Observability”Know
- Security needs audit logs, runtime events, and metrics shipped off the cluster.
Read
Demo: Who changed this? managedFields remembers
-
Create a namespace for this demo and make it the default for your context.
Terminal window kubectl create namespace kcsa-observekubectl config set-context --current --namespace=kcsa-observe -
Change one object with three different tools.
Terminal window kubectl create deployment web --image=registry.k8s.io/e2e-test-images/agnhost:2.66.1 -- /agnhost netexec --http-port=8080kubectl scale deployment web --replicas=2kubectl label deployment web reviewed=yeskubectl patch deployment web --field-manager=incident-script -p '{"spec":{"replicas":3}}' -
Ask the object who set which field.
Terminal window kubectl get deployment web --show-managed-fields -o json | jq -r '.metadata.managedFields[] | "\(.manager)\t\(.operation)\t\(.time)"'kubectl events --for deployment/web
What you should see: managedFields lists kubectl-create, kubectl-label, and incident-script with timestamps, even without an audit log. Pair it with events and container logs for a quick first look; for evidence that holds up, you need the audit log, because managedFields records a tool name, not a user.
Clean up:
kubectl config set-context --current --namespace=defaultkubectl delete namespace kcsa-observeService Mesh
Section titled “Service Mesh”Know
- A mesh provides mTLS between services, identity-based authorization, and traffic telemetry.
Read
Demo: use the CKS demo for “Implement Pod-to-Pod encryption (Cilium, Istio)”. It encrypts pod traffic with Cilium and WireGuard; a mesh such as Istio does the same with mutual TLS and adds per-service identities.
Know
- Kubernetes uses a cluster CA for component and client certificates. Know which certificates exist and when they expire.
Read
Demo: Read the cluster’s certificates
-
List the certificates kubeadm created and when they expire.
Terminal window docker exec kind-control-plane kubeadm certs check-expiration -
Inspect the API server’s serving certificate.
Terminal window docker exec kind-control-plane cat /etc/kubernetes/pki/apiserver.crt | openssl x509 -noout -subject -issuer -enddate -ext subjectAltNamedocker exec kind-control-plane cat /etc/kubernetes/pki/etcd/ca.crt | openssl x509 -noout -subject
What you should see: There are separate CAs for the cluster, etcd, and the front proxy. The API server certificate lists every name and IP clients may use (kubernetes.default.svc, the cluster IP, localhost). Leaf certificates last one year and CAs ten; expired certificates are a classic cause of a cluster that stops working on the same day a year after install.
On this site
Connectivity
Section titled “Connectivity”Know
- Control plane to node traffic, node to node, and egress to the internet should all be explicit and encrypted where possible.
Read
Demo: The API server reaches into nodes
-
Create a namespace for this demo and make it the default for your context.
Terminal window kubectl create namespace kcsa-connectkubectl config set-context --current --namespace=kcsa-connect -
Logs, exec, and port-forward all go from the API server to the kubelet.
Terminal window kubectl run web --image=registry.k8s.io/e2e-test-images/agnhost:2.66.1 -- netexec --http-port=8080kubectl wait --for=condition=Ready pod/web --timeout=60skubectl logs web -v=6 2>&1 | grep -E 'GET https' | head -1 -
The same path, used directly through the API server proxy.
Terminal window kubectl get --raw /api/v1/nodes/kind-worker/proxy/pods | jq '.items | length'kubectl get --raw /api/v1/nodes/kind-worker/proxy/healthz; echo
What you should see: kubectl logs asks the API server, which then connects to the kubelet on port 10250. The proxy path returns every pod on the node. This connection runs from the control plane into each node, so on managed or segmented networks it is often tunnelled (for example with Konnectivity).
Clean up:
kubectl config set-context --current --namespace=defaultkubectl delete namespace kcsa-connectAdmission Control
Section titled “Admission Control”Know
- Built-in admission plugins, ValidatingAdmissionPolicy (CEL), and webhooks (Kyverno, Gatekeeper) enforce policy at create time.
Read
Demo: See every admission step a request passes
-
Create a namespace for this demo and make it the default for your context.
Terminal window kubectl create namespace kcsa-admissionkubectl config set-context --current --namespace=kcsa-admission -
Built-in admission plugins are API server flags; dynamic admission is objects.
Terminal window docker exec kind-control-plane grep -- '--enable-admission-plugins' /etc/kubernetes/manifests/kube-apiserver.yamlkubectl get mutatingwebhookconfigurations,validatingwebhookconfigurations,validatingadmissionpolicies,mutatingadmissionpolicies -
Watch a mutating step change a pod, then a validating step reject one.
Terminal window kubectl create quota pods --hard=pods=1kubectl apply -f - <<'EOF'apiVersion: v1kind: LimitRangemetadata:name: defaultsspec:limits:- type: ContainerdefaultRequest: {cpu: 50m, memory: 32Mi}EOFkubectl run first --image=registry.k8s.io/e2e-test-images/agnhost:2.66.1 -- pausekubectl get pod first -o jsonpath='{.spec.containers[0].resources}{"\n"}'kubectl run second --image=registry.k8s.io/e2e-test-images/agnhost:2.66.1 -- pause
What you should see: kubeadm enables NodeRestriction on top of the default plugins. The LimitRange plugin mutated first to add requests it didn’t have, and the ResourceQuota plugin rejected second. Mutating admission runs before validating, and both run after authorization.
Clean up:
kubectl config set-context --current --namespace=defaultkubectl delete namespace kcsa-admissionOn this site
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.