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:Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
- Package Kubernetes manifests into an OCI artifact
- Sign the artifact with Cosign
- Configure Flux to verify signatures on pull
- Flux v0.35+ installed and configured
dockerandkubectlCLI 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:2. Install Cosign and Generate a Key Pair
Download the latest Cosign release and make it executable: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:4. Verify the Artifact Manually
Confirm the signature before deploying: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 anOCIRepository resource that enforces signature verification:
- 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:CLI Commands at a Glance
| Command | Description |
|---|---|
flux push artifact ... | Push manifests as an OCI artifact |
cosign generate-key-pair | Generate a private/public key pair |
cosign sign --key cosign.key ... | Sign an OCI artifact |
cosign verify --key cosign.pub ... | Verify a signature on an OCI artifact |
kubectl create secret generic cosign-pub | Store Cosign public key in Kubernetes |