Image Signature Verification Policy with Secrets
This guide demonstrates how to use Kubernetes Secrets to store public keys for Kyverno image signature verification, providing better security and key management compared to embedding keys directly in policies.
TOC
Why Use Secrets for Public Keys?
Using Kubernetes Secrets for storing public keys offers several advantages:
- Enhanced Security: Keys are stored securely in the Kubernetes Secret store
- Easy Key Rotation: Update keys without modifying policies
- Access Control: Use RBAC to control who can access the secrets
Quick Start
1. Generate and Store Keys in Secret
2. RBAC Configuration for Keyverno
Create Service Account for Kyverno
Create Role for Secret Access
Bind Role to Service Account
3. Create Policy Using Secret Reference
4. Test the Configuration
Secret Creation Methods
Method 1: From File
Method 2: From Literal String
Method 3: From YAML Manifest
Common Use Cases
Scenario 1: Single Team with One Secret
Simple setup where one team manages all image signatures:
Scenario 2: Multi-Team with Different Secrets
Different teams have their own signing keys and secrets:
Scenario 3: Critical Images Requiring Multiple Signatures
High-security environments where multiple teams must sign critical images:
Scenario 4: Offline Environment with Secrets
Using secrets in air-gapped environments: