Kubernetes container image security: red vs blue
Vinnie, on the red team, follows an image from a base you didn't build, through a registry you don't control and a tag that can move, into a cluster that runs it unchecked; Space Llama, on the blue team, pins by digest, scans with Trivy, signs and verifies with Sigstore cosign, and starts from minimal or distroless images.
Diagrams in this video · 1Free in archhy
Now try it on a real cluster
The videos are free. Gazeek's hands-on labs give you a real Kubernetes cluster in your browser for every lab, with checks that tell you when you've got it right: the practice the CKA and CKAD exams need.
The diagrams, full size
Copy any of them into archhy, free, and change it for your own system.
After this lesson you can
- Explain how base images, registries and movable tags bring in code you didn't choose
- Pin an image by digest, scan it, and verify its signature
- List the images your cluster runs and spot unpinned tags
Transcript
Kubernetes container image security: red vs blue
Space Llama. Blue team. Today, container images. Vinnie. Red team. Do you know what's in yours? Our app. And a few hundred packages you've never met.
Where an image picks up a gap
Here's the chain, from my side. One. The base image. A whole operating system you didn't build, with packages nobody's patched. Every known vulnerability in there is a gap. Two. Your build adds your code, and pushes it to a registry. Pull from a registry you don't control, and whoever does control it decides what you run. Three. The tag. Colon latest, or even colon one point four. Tags can be moved to a different image. You'd pull new code without changing a line. Four. The cluster pulls whatever the tag points to, and runs it. Nobody checks who built it. So it goes wrong before the cluster ever sees it. Blue covers every link. Every link? Good luck.
Blue closes it: pin by digest
Blue's turn. Pin by digest. A digest is a hash of the image's content. Tags can be moved. Digests are fixed. Keep the tag there for people to read. When both are given, only the digest is used to pull.
Blue closes it: scan, sign, verify
Scan it. Trivy finds known vulnerabilities in the image. Run it in the build pipeline. With exit code one, a high or critical finding fails the build. Sign it, here keyless, then verify the signature. Sigstore's cosign checks the image was signed by the identity you expect, from the issuer you expect. Better still, check signatures at the cluster's door, with an admission controller. That's episode six.
Smaller images, fewer gaps
Start smaller. A minimal base image has fewer packages, so fewer to patch. Distroless images go further. Only your app and its runtime dependencies. No shell, no package manager. And allow images only from registries you trust. An admission policy can refuse the rest. Episode six again.
Red asks, blue answers
Question for blue. No shell? How do you debug that? With an ephemeral debug container, attached when you need it. The Kubernetes security checklist suggests exactly that. Question for red. What do you sniff out first? Colon latest. And images from a registry nobody on the team can name.
Check your own cluster
Now check your own cluster. List every image it runs. Kubectl get pods, all namespaces, with a JSON path for each container's image. The Kubernetes docs have the full command. Look for tags without digests, colon latest above all, and registries you don't control. Then scan what's running now, not only what you built last month. New vulnerabilities turn up in old images.
Who won?
Round five. Mine. Yours? You can pin, scan and sign. But nobody's checking at the door yet. Fair. Next time, we fix the door.
The full article, and what's next
Next time, admission control. The cluster's front door. I'll knock.
Hands-on labs
Now try it on a real cluster
A real Kubernetes cluster in your browser for every lab, checked as you go.
See the labs









