Skip to main content
In this guide, you’ll learn how to sign and verify OCI artifacts using SigStore’s Cosign alongside Flux. By the end, you’ll be able to:
  1. Package Kubernetes manifests into an OCI artifact
  2. Sign the artifact with Cosign
  3. Configure Flux to verify signatures on pull
  • Flux v0.35+ installed and configured
  • docker and kubectl CLI tools available
  • Access to a container registry (e.g., GitHub Container Registry)

1. Package and Push Manifests as an OCI Artifact

Assume your repository has Nginx manifests structured like this:
Authenticate with your registry and push:
Expected output:

2. Install Cosign and Generate a Key Pair

Download the latest Cosign release and make it executable:
Generate your key pair:
You’ll be prompted to create a passphrase:
Store your cosign.key in a secure vault. Loss or compromise of the private key may allow unauthorized signatures.

3. Sign the OCI Artifact

Use your private key to sign the pushed artifact:
Provide the passphrase when prompted. Cosign uploads the signature alongside the image.

4. Verify the Artifact Manually

Confirm the signature before deploying:
You should see:

5. Store the Public Key in Kubernetes

Flux verifies signatures by reading your public key from a Kubernetes Secret:

6. Configure Flux to Verify OCI Artifacts

Create an OCIRepository resource that enforces signature verification:
When Flux pulls this artifact, it will:
  • Fetch the OCI layer
  • Verify the signature against the supplied public key
  • Abort on failure or extract the tarball on success

7. Inspect the Verification Status

Check the status of your OCIRepository:
Relevant status snippet:
If signature verification fails, Flux will not apply the artifact.

CLI Commands at a Glance


Watch Video