Overview
Tekton Pipelines provides HA support for two main components:- Controller - Uses active/active model with distributed workqueue across buckets
- Webhook - Stateless deployment that can be easily scaled and auto-scaled
Controller High Availability
The Controller achieves HA through an active/active model where all replicas can receive and process work items. The workqueue is distributed across buckets, with each replica owning a subset of those buckets.Configuring Controller Replicas
To enable HA for the Controller, increase the replica count to more than one:config/controller.yaml:
Leader Election Configuration
Leader election is configured in theconfig-leader-election-controller ConfigMap:
string
default:"1"
Number of buckets used to partition the key space of each Reconciler. If this number is M and the replica count is N, the N replicas compete for M buckets.
Maximum value is 10.
duration
default:"60s"
How long non-leaders wait before trying to acquire the lock. Core Kubernetes controllers use 15s.
duration
default:"40s"
How long a leader will try to renew the lease before giving up. Core Kubernetes controllers use 10s.
duration
default:"10s"
How long the leader election client waits between action attempts. Core Kubernetes controllers use 2s.
How Leader Election Works
- The workqueue is divided into buckets based on the
bucketsconfiguration - Each controller replica competes to become the leader of specific buckets
- The replica that owns a bucket processes all work items partitioned into that bucket
- If a replica fails, other replicas can take over its buckets
Disabling Controller HA
To disable HA, scale back to one replica:disable-ha flag in the controller deployment:
Webhook High Availability
The Webhook deployment is stateless, making it easier to configure for HA and enabling autoscaling based on load.Configuring Webhook Replicas
Increase the number of webhook replicas:config/webhook.yaml:
Horizontal Pod Autoscaling
Tekton Pipelines includes a HorizontalPodAutoscaler for the webhook:The webhook requires a Metrics Server in your cluster for the HorizontalPodAutoscaler to function properly.
Avoiding Disruptions
To ensure minimum webhook availability during node disruptions, define a PodDisruptionBudget:Pod Anti-Affinity
Webhook replicas are configured with pod anti-affinity by default to avoid scheduling all replicas on the same node:Cluster Autoscaler Considerations
By default, the webhook deployment is not configured to block the Cluster Autoscaler from scaling down nodes. During node drains, the webhook might become temporarily unavailable. To prevent this, either:- Add the safe-to-evict annotation:
- Configure multiple webhook replicas (recommended approach)
Prerequisites for HA
Metrics Server
High concurrency scenarios and webhook autoscaling require a Metrics Server:Complete HA Configuration Example
Verification
Verify your HA configuration:Best Practices
- Start with 3 replicas for both controller and webhook in production environments
- Configure PodDisruptionBudgets to maintain availability during cluster maintenance
- Use HPA for webhooks to handle variable load automatically
- Monitor metrics to tune replica counts and resource requests/limits
- Increase bucket count to 10 when running many controller replicas for better load distribution
- Test failover by draining nodes or deleting pods to verify HA behavior
- Set appropriate resource requests/limits to ensure pods can be scheduled across multiple nodes