Skip to main content
In this guide, we’ll walk through signing and verifying an OCI artifact using Cosign and then configuring Flux CD to fetch and verify that artifact before deploying it in Kubernetes.

Prerequisites

  • A fork or clone of the bb-appsource-git repository
  • Docker CLI installed and authenticated
  • A GitHub personal access token with read:packages and write:packages scopes
  • Flux CLI installed
  • A Cosign key pair generated (cosign.key and cosign.pub)

1. Prepare the Repository

  1. Switch to a new feature branch:
  2. Under the manifests/ folder, confirm you have:
    • namespace.yaml
    • deployment.yaml
    • service.yaml
  3. Verify your deployment.yaml uses version 7.10.0:

2. Authenticate to GitHub Container Registry

Log in to GitHub Container Registry (GHCR) using your username and personal access token:
Ensure your token has at least read:packages and write:packages scopes to push and pull images.

3. Push the OCI Artifact with Flux

Package your manifests folder and push it as an OCI artifact:
Expected output:
Verify the new package under Packages → bb-app on GitHub.

4. Sign the Artifact with Cosign

  1. Pull the image by tag:
  2. Sign by digest:
Approve uploading to the transparency log when prompted. A .sig blob is now attached to your OCI package.

5. Verify the Signature Locally

Use your public key to confirm the artifact’s integrity:
You should see:

6. Configure Flux to Pull and Verify

  1. Change to your Flux cluster repo:
  2. Create an OCIRepository source for GHCR:
  3. Edit 10-demo-source-oci-bb-app.yaml to include Cosign verification:
  4. Apply the source:
  5. Ensure secrets exist:
  6. Create and apply a Kustomization to deploy the manifests:

7. Confirm Verification and Deployment

  1. Reconcile and check the OCI source status:
    You should see READY True.
  2. Inspect the SourceVerified condition:
  3. Verify deployment in the 10-demo namespace:
  4. Access the application on its NodePort (e.g., localhost:30010). You should see version 7.10.0 of Block Buster:
The image shows a "Block Buster" game interface with colorful blocks, a paddle, and a ball, set against a starry background. Game details like pod name, IP, and version are displayed at the top.

Watch Video

Practice Lab