Originally published on kuryzhev.cloud
A team signs every release image in CI, adds a "we sign our images" line to the security questionnaire, and then someone runs kubectl run debug --image=docker.io/random/tool:latest in production. Nothing stops it, because signing only produces evidence. Something has to check that evidence at the moment a Pod is created. The cluster-side gate is what lets you verify cosign signatures where it matters: at admission.
Short answer: install an admission controller that understands Sigstore (Kyverno or the Sigstore policy-controller), pin it to your CI identity (issuer plus subject, or a public key), and run it in audit mode first, then enforce. It applies whenever you control what reaches the registry and want to refuse everything else. It does not replace vulnerability scanning, and it adds a new availability dependency to your control plane.
What this actually does
A cosign signature is a small artifact stored in the registry next to the image, tied to the image's digest. With keyless signing, it also carries a short-lived certificate from Fulcio that records who signed (an OIDC issuer and a subject such as a GitHub Actions workflow path), plus an entry in the Rekor transparency log.
At admission, the Kubernetes API server sends the Pod to a validating or mutating webhook. The controller resolves each image reference, fetches the signature from the registry, and checks it cryptographically. It then compares the signer's identity with your policy. In enforce mode, any failed step causes the API server to reject the Pod, so nothing is scheduled. In audit mode, the failure is only recorded.
The gate has to be an external webhook. ValidatingAdmissionPolicy uses CEL expressions evaluated in-process and cannot call a registry, so it cannot check signatures by itself. It can complement the webhook (for example, to require digests), but it cannot replace it.
This protects against an image being swapped or pushed by someone who is not your pipeline. It does not tell you the image is free of vulnerabilities. A correctly signed image from your own CI can still contain a vulnerable library.
How people use it wrong
The most common failure is a policy that proves too little. A keyless policy with subjectRegExp: ".*" accepts a signature from anyone with a Sigstore identity, including an attacker's own GitHub account. A signature is only meaningful when it is bound to your issuer and a narrow subject.
Other documented pitfalls:
- Verifying tags, not digests. A tag like
:1.4can be repointed after verification. If the controller does not rewrite the Pod to the digest, the kubelet may pull something different from what was checked. - Staying in audit mode forever. Reports pile up, nobody reads them, and the cluster is never protected.
- Setting the webhook
failurePolicytoIgnoreto avoid outages. That turns every controller crash or timeout into a silent bypass. - Excluding whole namespaces "temporarily". A broad exclusion of
kube-systemordefaulttends to become permanent, and an excluded namespace is an obvious target for anyone trying to get around the policy. - Signing in CI but pushing mirrors unsigned. If pods pull from a mirror registry, the signature has to exist at that location, or the policy has to reference the original.
Watch out for: a policy that matches only Pod and misses init containers or ephemeral containers. Check your controller's docs to confirm that all container types are covered for your version.
The correct approach
First, sign by digest in CI. This example assumes a GitHub Actions job with id-token: write permission. With that permission, cosign performs keyless signing using the workflow's OIDC token.
# Sign the exact digest that was just pushed, never a tag cosign sign --yes registry.example.com/team/app@sha256:<digest> # Verify locally with the SAME identity the cluster will enforce cosign verify registry.example.com/team/app@sha256:<digest> \ --certificate-oidc-issuer https://token.actions.githubusercontent.com \ --certificate-identity "https://github.com/example-org/app/.github/workflows/release.yml@refs/heads/main" 🧪 Lab — try this in your browser
- Kubernetes Manifest Linter — Lint multi-document Kubernetes YAML for production readiness and security, with line:col diagnostics, severity grouping, a 0-100 score and fix hints.
If the local cosign verify fails, the cluster policy will fail too, so fix this step first. Then apply a Kyverno policy that uses the same identity.
Current Kyverno releases deprecate the spec-level validationFailureAction. They use a per-rule failureAction field instead, which for image verification sits on each verifyImages entry. Check the Kyverno documentation for your installed version.
apiVersion: kyverno.io/v1 kind: ClusterPolicy metadata: name: verify-cosign-signatures spec: failurePolicy: Fail # a broken webhook must not become a bypass webhookTimeoutSeconds: 15 rules: - name: require-ci-signature match: any: - resources: kinds: ["Pod"] verifyImages: - imageReferences: - "registry.example.com/team/*" failureAction: Audit # switch to Enforce after reviewing reports mutateDigest: false # must be false in Audit; set true with Enforce verifyDigest: true required: true attestors: - entries: - keyless: issuer: "https://token.actions.githubusercontent.com" subject: "https://github.com/example-org/app/.github/workflows/release.yml@refs/heads/main" rekor: url: "https://rekor.sigstore.dev" To confirm it works, apply the policy in Audit mode and create a Pod with an unsigned image from the matched registry path. Check the policy reports with kubectl get policyreport -A and look for a failing result for your rule.
Once the reports are clean for legitimate workloads, change failureAction to Enforce, set mutateDigest: true so the Pod is rewritten to the verified digest, and repeat the test. The Pod creation should now be rejected with an error from the admission webhook that mentions image verification. The exact message text varies by version.
Note that imageReferences covers only your registry path. Images outside it pass untouched. To block everything unsigned, add a separate rule that denies images not matching an allowed registry pattern.
Advanced patterns
Attestations. A signature says "this identity vouched for this digest." Attestations (SBOM, SLSA provenance, scan results) say what was vouched for. Kyverno can check attestation predicates with conditions, for example requiring that provenance names your builder. Newer cosign releases changed the default signature bundle format, so confirm that your controller version understands what your cosign version produces.
Scoped exceptions. Rather than excluding namespaces in the policy, use a PolicyException resource restricted to a specific policy, rule, and workload. It is reviewable in Git, and removing it restores enforcement. Depending on your Kyverno version and install options, exception support may need to be enabled, and it can be limited to specific namespaces.
Multiple attestors. You can require that both the build pipeline and a release approver (a separate key or identity) have signed. This is useful for regulated environments and costs an extra signing step.
Private or air-gapped clusters. Public Fulcio and Rekor are external dependencies. If your clusters cannot reach them, run a private Sigstore stack, or use key-based signing with a public key (ideally from a KMS) in the policy. See the Sigstore documentation for the trade-offs.
Alternative controllers. The Sigstore policy-controller offers a ClusterImagePolicy resource and is a good fit if you want only signature checks. By default it enforces only in namespaces opted in with a label, so check that your namespaces are actually included.
Kyverno makes more sense if you already use it for other policies. Newer Kyverno releases also provide a CEL-based ImageValidatingPolicy type alongside ClusterPolicy. For general background on admission webhooks, see the Kubernetes admission controller docs.
Performance notes
Every Pod creation that matches a rule can trigger registry calls: a manifest lookup, a signature fetch, and possibly a transparency log check. That time is added to the API request, and the webhook timeout (at most 30 seconds in Kubernetes) caps it.
A slow or rate-limited registry makes kubectl apply and rollouts slow. One possible failure mode is a Deployment scaling up in a burst and exhausting registry rate limits.
- Use digests. With
mutateDigestenabled in enforce mode, later checks can hit a cache instead of re-resolving tags. Kyverno has an image verification cache; check its flags in the docs for your release. - Run the controller with multiple replicas and a PodDisruptionBudget. With
failurePolicy: Fail, a down webhook blocks creation of every resource its webhook configuration matches, which is the actual blast radius of this design. - Keep match scopes narrow. Matching only the registry paths you own avoids pointless lookups for system images.
- Watch the metrics. Kyverno exposes Prometheus metrics for policy results and admission review duration, with names such as
kyverno_policy_results_totalandkyverno_admission_review_duration_seconds. Verify the names in your version. Alert on rising p95 duration and on spikes in rejected requests.
Watch out for: the controller's own images. If the signature check is required for the namespace where Kyverno runs, a restart during a registry outage can deadlock recovery. Exempt that one namespace with a precise exception, and protect it with RBAC.
When not to bother: a single-team cluster that pulls only from one private registry with tight push permissions gets less from this than a multi-tenant platform. The cost is real: a new critical-path component, policy upkeep, and CI changes. More platform security notes are on kuryzhev.cloud.



