Getting Started
This guide helps new users quickly set up Tekton Chains to secure their CI/CD pipelines by generating and verifying cryptographic signatures for Tekton TaskRuns.
TOC
Introduction
Use Cases
Tekton Chains helps you secure your software supply chain by automatically generating cryptographic signatures for your build artifacts. This guide demonstrates how to set up Tekton Chains, generate a signing key, run a simple task, and verify its signature.
Estimated Reading Time
10-15 minutes
Important Notes
- Tekton Chains is installed by default in the
tekton-pipelinesnamespace when using Alauda Devops Pipelines Operator - The signing keys should be securely managed; in production environments, consider using a key management system (KMS)
- This guide uses the simplest configuration for demonstration purposes
Prerequisites
- A Kubernetes cluster with Tekton Pipelines and Tekton Chains installed
kubectlCLI installed and configured to access your clustercosignCLI tool installedjqCLI tool installed
Process Overview
Step-by-Step Instructions
Step 1: Generate Signing Keys
For more details, please refer to Signing Key Configuration
Tekton Chains uses cryptographic keys to sign artifacts. By default, it looks for a secret named signing-secrets in the Chains namespace.
-
Install cosign if you haven't already
-
Generate a key pair and store it as a Kubernetes secret:
TIPThis password will be stored in a Kubernetes secret named
signing-secretsin thetekton-pipelinesnamespace. -
Verify the secret was created:
Step 2: Configure Tekton Chains
Configure Tekton Chains to store artifacts in Tekton format by applying the following configuration:
Explanation of YAML fields:
artifacts.oci.storage: The storage type for OCI artifacts. Set to an empty string to skip store.artifacts.taskrun.format: The format of the taskrun artifact. Set toin-tototo use in-toto format.artifacts.taskrun.storage: The storage type for taskrun artifacts. Set totektonto store in Tekton TaskRun annotations.
Step 3: Run a Sample Task
Now let's create a simple TaskRun that Chains will automatically sign.
-
Create a simple TaskRun:
TIPPlease replace the image
<registry>/ops/busybox:latestwith the actual image you want to use. -
Wait for the TaskRun to complete:
Wait until the status shows
Succeeded.
Step 4: Verify the Signature
Once the TaskRun completes, Tekton Chains will automatically sign it. Let's verify the signature.
-
Get the TaskRun UID:
-
Extract the signature:
-
Extract the payload using jq:
Signature Payload
-
Verify the signature using cosign:
If successful, you'll see
Verified OK.
Expected Results
After completing this guide:
- You have a working Tekton Chains setup with a signing key
- Your TaskRuns are automatically signed when they complete
- You can verify the signatures to ensure the integrity of your builds
This demonstrates the basic functionality of Tekton Chains. In a real-world scenario, you would:
- Configure Chains to sign container images and store signatures in your registry
- Set up a verification step in your deployment process
- Potentially use a cloud KMS for more secure key management