Enforcing signed container images in Kubernetes with Kyverno means admission control only allows workloads whose images match the signature policy you define. By the end of this procedure, you will have a working Kyverno verifyImages policy, a repeatable test method, and a clear way to confirm that signed images are admitted while unsigned or mismatched images are blocked.
You will need a Kubernetes cluster where you can create namespaces and deploy Kyverno, access to the image registry that stores your workloads, and a signing workflow already in place. If you are still deciding how to sign and verify images, start with Signing and verifying container images with Cosign and Sigstore, because this article assumes you already have signed images and want to enforce that policy inside the cluster.
The control here is admission-time enforcement, not post-deployment scanning. That distinction matters because a signed image policy prevents a non-compliant workload from starting in the first place, which is different from detecting a problem after it has already been scheduled. For a broader software supply chain view, the same control fits naturally alongside the measures described in Implementing software supply chain assurance controls for technical teams.
Key takeaways
- Use digest-based image references, because Kyverno should verify an immutable image, not a mutable tag.
- Start with a narrow namespace scope and move from audit to enforce only after you have a clean test result.
- Match the Kyverno policy to the same signing method you use in the build pipeline, whether that is key-based or identity-based.
- Treat exceptions as temporary and explicit, especially for system namespaces and break-glass access.
Set the goal, prerequisites, and trust model
Start by deciding what you are actually trusting. In a Kyverno image verification policy, the trust decision usually rests on three things, the image reference, the signature material, and the identity or key you expect to see. If you do not define those boundaries first, the policy can become either too broad, which weakens assurance, or too narrow, which breaks normal releases.
For a practical SME deployment, the simplest trust model is to require images by digest, verify them against a known public key or attestation source, and scope the policy to application namespaces before you extend it cluster-wide. That gives you a controlled rollout path and avoids surprising platform workloads such as ingress controllers, storage add-ons, or monitoring agents.
Before you start, confirm that you can answer four questions. Which namespaces should be protected first, which registry hosts the images, which signing identity or key should be accepted, and what should happen when verification fails. In most environments, the answer to the last question should be deny in production and audit in early testing.
Prepare image signing and registry metadata
Kyverno needs a stable image reference to verify, so the first operational rule is to use immutable digests rather than mutable tags. A tag such as app:latest can point to different content over time, while a digest such as app@sha256:... identifies one exact image manifest. If you enforce signatures against tags, you create avoidable ambiguity during deployment and incident review.
Confirm the signing workflow and key material you will rely on. If you use Cosign with a key pair, keep the public key available to the cluster policy and protect the private key in your build system or signing service. If you use keyless signing, make sure you can express the expected identity and issuer clearly enough for the policy to validate them. The policy should reflect the trust decision you already make in your release process, not invent a new one.
Record the image references you intend to enforce, including the registry host, repository path, and digest. A useful working habit is to capture one known-good image and one known-bad image before you write the policy. That gives you a clean test pair for later validation and makes troubleshooting much easier if the admission decision is not what you expected.
Install Kyverno and confirm admission control is active
Install Kyverno into the cluster using the method you already standardise on, then verify that the admission webhook and controller components are running. Kyverno must be able to intercept create and update requests for Pods and workload controllers, otherwise the policy will exist only on paper. In a managed cluster, also confirm that the platform allows validating admission webhooks and that no network policy or firewall rule blocks them.
The exact installation method varies by platform, but the outcome should be the same, Kyverno pods are healthy, the webhook service is reachable, and the CRDs are present. Check the namespace, the deployment status, and the webhook configuration before you move on. If any of those are missing, policy evaluation will be incomplete or inconsistent.
Run the following commands to confirm the control plane objects are present. This sequence checks the Kyverno namespace, the deployment rollout, and the webhook configuration. A clean result means Kyverno is ready to evaluate admission requests.
kubectl get namespace kyverno
kubectl -n kyverno get deploy
kubectl get validatingwebhookconfiguration | grep kyverno
kubectl get mutatingwebhookconfiguration | grep kyverno
If the deployments are not available or the webhook objects are missing, stop here and fix the installation first. Admission policy troubleshooting is much harder when the controller itself is not healthy.
Create a Kyverno policy that only admits signed images
Now create the policy that enforces signed images. Kyverno’s verifyImages rule checks image signatures at admission time and can reject a workload if the image does not match the expected verification criteria. For a first implementation, keep the scope narrow, for example one application namespace, so you can observe the effect without risking unrelated workloads.
The policy below verifies images from a specific registry path using a public key. Replace the example registry path and key reference with your own values before applying it. The structure is valid Kyverno YAML, and a successful admission decision means the image matched the verification rule exactly as defined.
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: verify-signed-images
spec:
validationFailureAction: Enforce
background: false
rules:
- name: verify-app-images
match:
any:
- resources:
kinds:
- Pod
namespaces:
- app-prod
verifyImages:
- imageReferences:
- "registry.example.com/apps/*"
attestors:
- entries:
- keys:
publicKeys: |
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAw7m0m1Q3xQm3g7g1ZQ3w
7m0m1Q3xQm3g7g1ZQ3w7m0m1Q3xQm3g7g1ZQ3w7m0m1Q3xQm3g7g1ZQ3w7m0m1Q
Qm3g7g1ZQ3w7m0m1Q3xQm3g7g1ZQ3w7m0m1Q3xQm3g7g1ZQ3w7m0m1Q3xQm3g7g1
ZQ3w7m0m1Q3xQm3g7g1ZQ3w7m0m1Q3xQm3g7g1ZQ3w7m0m1Q3xQm3g7g1ZQ3w7m0
m1Q3xQm3g7g1ZQ3w7m0m1Q3xQm3g7g1ZQ3w7m0m1Q3xQm3g7g1ZQ3w7m0m1Q3xQm
3g7g1ZQ3w7m0m1Q3xQm3g7g1ZQ3w7m0m1Q3xQm3g7g1ZQ3w7m0m1Q3xQm3g7g1ZQ
3wIDAQAB
-----END PUBLIC KEY-----
This policy checks Pods in the app-prod namespace and only allows images that match the registry pattern and signature trust anchor you defined. If you prefer a different scope, change the namespace list, but keep the first rollout limited so you can see exactly which workloads are affected.
Choose the verification mode to match your release process. If your build pipeline signs every release image, a key-based trust model is straightforward. If you use identity-based verification, the policy should assert the expected issuer and subject rather than a static public key. The important point is consistency between the signing process and the admission rule.
For teams that want to align policy enforcement with broader supply chain controls, this is the same discipline used when enforcing SBOM requirements in CI/CD pipelines. The difference is that Kyverno is making the decision at cluster admission, not in the build stage.
Apply the policy to a test workload and check the result
Test the policy with a known-good workload first. Use a Pod manifest that references a signed image by digest in the protected namespace. If the image is signed correctly and the policy matches the registry path and trust material, the Pod should be admitted and scheduled normally.
Then test a workload that should fail. The easiest negative test is an unsigned image, or a signed image from a registry path that does not match the policy. The admission request should be denied, and the error message should point to the verification failure rather than a generic scheduling issue.
Use a manifest like the one below for a signed image test. Replace the image reference with your own digest-based reference before applying it. A successful apply means the image passed Kyverno verification at admission time.
apiVersion: v1
kind: Pod
metadata:
name: signed-image-test
namespace: app-prod
spec:
containers:
- name: app
image: registry.example.com/apps/web@sha256:1111111111111111111111111111111111111111111111111111111111111111
command: ["sh", "-c", "sleep 3600"]
Apply the manifest and watch the result. If the Pod is created, the policy accepted the image. If it is denied, read the admission message carefully, because it usually tells you whether the failure was caused by the signature, the registry pattern, or the trust material.
For the negative test, use an image that is not signed by the expected key or identity. The policy should reject it. That rejection is the control working as intended, because it prevents a non-compliant workload from entering the cluster.
Tune exceptions, namespace scoping, and rollout controls
Once the basic policy works, tune it for real operations. Most clusters need exceptions for system namespaces, platform add-ons, or workloads that are not yet part of the signing pipeline. Handle those exceptions explicitly, rather than weakening the policy globally. A narrow exception is easier to review and remove later than a broad one that quietly becomes permanent.
Use namespace scoping to separate rollout phases. A common pattern is to start with one application namespace in audit mode, review the policy reports, then move to enforce once the release pipeline consistently produces signed images. After that, expand to more namespaces in stages. This reduces release friction and gives engineering teams time to fix signing gaps without blocking unrelated work.
If you need a break-glass path, define it with the same care you would use for any privileged access route. Limit who can use it, log every use, and set a review date. A break-glass exception that is not monitored becomes a standing bypass, which defeats the purpose of admission control.
When you are ready to broaden coverage, consider how the policy fits with the rest of your supply chain assurance work. If you already have provenance checks, dependency controls, and release approvals in place, Kyverno becomes one layer in a wider control set rather than a standalone gate.
Verify the whole control and troubleshoot common failures
To verify the whole result, test three things together. First, a signed workload in scope should be admitted. Second, an unsigned or mismatched workload should be denied. Third, the policy should leave unrelated namespaces and system components unaffected. If all three are true, the control is behaving as designed.
When something goes wrong, start with the image reference. A tag instead of a digest is a common source of confusion, because the image content may not be the one you think you are verifying. Next, check the registry path pattern, because a small mismatch in repository naming can cause a valid image to fail policy evaluation. Then confirm that the public key or identity data in the policy matches the signing workflow exactly.
Admission logs and policy reports are the fastest way to diagnose issues. Look for webhook errors, signature verification failures, and namespace mismatches. If the controller cannot reach the registry or cannot fetch the metadata it needs, the failure may look like a policy problem even though the root cause is connectivity or registry access.
Common failures usually fall into a small number of categories. The image was signed with a different key than the one in the policy. The workload used a mutable tag instead of a digest. The namespace was not included in the match block. The registry path pattern was too narrow. The webhook was healthy, but the cluster could not reach the registry. Each of those can be checked directly, which is why a staged rollout with one known-good and one known-bad workload is so useful.
If you want to extend this control further, the next logical step is to combine Kyverno admission checks with build-time signing, provenance, and SBOM enforcement. That gives you a stronger chain of evidence from source to cluster, and it keeps the policy decision anchored in the same release process your team already uses.
If you want help designing a practical rollout, or you need to align image verification with a wider software supply chain and ISO 27001-aligned control set, Speak to a consultant.
Frequently asked questions
How does Kyverno verify signed container images at admission time?
Kyverno intercepts the workload admission request, checks the image reference against the policy, and validates the signature or attestation material you defined. If the image does not match the expected trust anchor, the request is denied before the workload is created.
What usually causes a Kyverno image verification policy to fail?
The most common causes are a mismatch between the signing key and the policy, use of a mutable tag instead of a digest, an incorrect registry path pattern, or a namespace that is not included in the match block. Registry access problems can also surface as verification failures.


Comments are closed