Restricting Permitted Image Registries
Securing a supply chain means deciding what the cluster will run before it runs it. This guide writes a policy that permits two registries and requires a digest, shows each rule refusing something different, and is clear about what admission control cannot check.
Supply Chain Security Guide 28 of 40 Intermediate
- Kubernetesapiserver v1.36.4, kubelet v1.36.3
- Runtimecontainerd 2.2.6
- CNICilium 1.18.1
- Built withkubeadm v1.36.3
- TimeAbout 16 min
ValidatingAdmissionPolicy with CEL, built into the apiserver. It evaluates the object in front of it and cannot make a network call, which decides what this control can and cannot do.
- Host kernel7.0.0-29
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| CKA6001 | 192.168.0.46 | Ubuntu 26.04 LTS | Control Plane Node (tainted NoSchedule) | 2 Core | 4 GB | 50 GB |
| CKA6001-NODE01 | 192.168.0.47 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
| CKA6001-NODE02 | 192.168.0.48 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
This guide includes
Use this when the cluster should refuse images from anywhere you did not approve. This matters because by default it will run anything from anywhere - and the policy that fixes that cannot do everything either.
- confirming the cluster will run anything, and finding where its images come from today
- writing one policy with two rules - permitted registries, and that images must be pinned
- making three attempts, one breaking each rule and one passing both
- finding what this policy cannot do, by looking at the Pods it admitted
- checking what admission is really running, and the older plugin the exam still asks about
Before you start
- guide 33 - why the digest rule exists.
-
The cluster will run anything from anywhere
-
One policy, two rules
-
Three attempts
-
What this policy cannot do
-
The plugin the exam still asks about