Pod Security Standards
Tekton supports running TaskRuns and PipelineRuns in namespaces with restricted pod security standards.Enabling Security Context
Set theset-security-context feature flag to apply security contexts to Tekton-injected containers:
- Applies SecurityContext to containers injected by the Pipelines controller
- Applies SecurityContext to Affinity Assistant containers
- Allows TaskRuns to run in namespaces with
restrictedpod security admission
Read-Only Root Filesystem
Enable read-only root filesystem for enhanced security:Requires
set-security-context to be enabled. Does not work on Windows platforms.SPIRE Integration (Experimental)
SPIRE provides non-falsifiable provenance for TaskRun results through cryptographic attestation.Architecture
The SPIRE integration architecture:- SPIRE server attests agents running on each cluster node
- Tekton Controller has permissions to create workload identity entries
- Controller retrieves identity for communicating with SPIRE server
- When TaskRun is created:
- Controller creates TaskRun pod
- Controller registers pod identity with SPIRE server
- Steps complete and entrypointer requests SVID from SPIRE agent
- SPIRE agent attests workload and issues SVID
- Entrypointer receives x509 SVID with certificate and private key
- Entrypointer signs TaskRun results and emits signatures to results
Enabling SPIRE
- Enable SPIRE during build:
- Set enforcement policy:
- Deploy SPIRE:
- Register Tekton Controller workload:
- Configure controller to access SPIRE agent socket:
- Configure SPIRE settings (optional):
SPIRE trust domain to use.
SPIRE agent socket path for SPIFFE workload API.
SPIRE server address for workload/node registration.
SPIRE node alias prefix.
Trusted Resources
Verify the authenticity and integrity of Tasks and Pipelines using cryptographic signatures.Verification Policy
Trusted Resources verification policy controls behavior when no matching policies are found:Policy when no matching verification policies exist.
fail- Fail TaskRun/PipelineRun if no matching policies foundwarn- Skip verification, log warning, continue executionignore- Skip verification silently, continue execution
Creating Verification Policies
Define VerificationPolicy resources to specify which keys can verify which resources:Credential Management
Git SSH Secrets
Requireknown_hosts field in Git SSH Secrets for server key validation:
known_hosts:
Disabling Credential Initialization
Disable Tekton’s built-in credential initialization and use Workspaces instead:- Tekton won’t scan service accounts for credentials
- Credentials won’t be automatically mounted into Steps
- Use Workspaces to explicitly mount credential Secrets
Disabling credential initialization prevents PipelineResources from working.
Registry Certificate Configuration
Configure self-signed certificates for private registries:SSL_CERT_DIR environment variable is set to /etc/ssl/certs by default. If your registry certificate is not in the default location, configure it using this ConfigMap.
Release Verification
Tekton Pipelines images are signed by Tekton Chains since v0.27.1.Verify Image Signatures with Cosign
Install cosign:Verify Transparency Logs with Rekor
Install rekor-cli:Verify Release Manifest
Compare digest inrelease.yaml with provenance:
Hermetic Execution Mode
Run Tasks in an isolated environment without network access (experimental alpha feature):Security Best Practices
- Enable security context for restricted pod security standards
- Require known_hosts for Git SSH authentication
- Use RBAC to limit who can create/modify Tekton resources
- Verify images using cosign before deployment
- Implement trusted resources verification for production
- Use private registries with authentication for container images
- Rotate credentials regularly
- Limit service account permissions to minimum required
- Use Workspaces for sensitive data instead of environment variables
- Enable audit logging for Tekton resource changes
- Scan container images for vulnerabilities
- Use pod security policies/standards appropriate for your environment
- Monitor for security events in controller logs
- Keep Tekton updated to latest stable version for security patches
Security Checklist
-
set-security-contextenabled for restricted namespaces -
require-git-ssh-secret-known-hostsenabled - Trusted resources verification configured
- RBAC policies defined and applied
- Service accounts follow least privilege principle
- Container images verified with cosign
- Private registry authentication configured
- Secrets stored in external secret manager
- Network policies restrict pod communication
- Audit logging enabled for Kubernetes API
- Regular security scans scheduled
- Incident response plan documented
- Security training completed for pipeline authors
Additional Resources
- Tekton Chains - Supply chain security for Tekton
- SPIFFE/SPIRE - Workload identity framework
- Sigstore - Keyless signing and verification
- Pod Security Standards
- Kubernetes Security Best Practices