|
| 1 | +--- |
| 2 | +title: "Configuring high-availability components" |
| 3 | +linkTitle: "Configuring high-availability components" |
| 4 | +weight: 50 |
| 5 | +type: "docs" |
| 6 | +--- |
| 7 | + |
| 8 | +Active/passive high availability (HA) is a standard feature of Kubernetes APIs that helps to ensure that APIs stay operational if a disruption occurs. In an HA deployment, if an active controller crashes or is deleted, another controller is available to take over processing of the APIs that were being serviced by the controller that is now unavailable. |
| 9 | + |
| 10 | +Active/passive HA in Knative is available through leader election, which is enabled by default after the Knative Serving control plane is installed. |
| 11 | + |
| 12 | +When using a leader election HA pattern, instances of controllers are already scheduled and running inside the cluster before they are required. These controller instances compete to use a shared resource, known as the leader election lock. The instance of the controller that has access to the leader election lock resource at any given time is referred to as the leader. |
| 13 | + |
| 14 | +HA functionality is available on Knative for the `autoscaler-hpa`, `controller`, `activator` , `kourier-control`, `kourier-gateway`, `istio-pilot`, and `istio-gateway` components. |
| 15 | + |
| 16 | +## Enabling leader election |
| 17 | + |
| 18 | +1. Enable leader election for the control plane controllers: |
| 19 | +``` |
| 20 | +kubectl patch configmap/config-leader-election \ |
| 21 | + --namespace knative-serving \ |
| 22 | + --type merge \ |
| 23 | + --patch '{"data":{"enabledComponents": "controller,hpaautoscaler,certcontroller,istiocontroller,nscontroller"}}' |
| 24 | +``` |
| 25 | + |
| 26 | +1. Restart the controllers: |
| 27 | + |
| 28 | +Note: you will take a brief amount of control plane downtime during this step. |
| 29 | + |
| 30 | +``` |
| 31 | +kubectl rollout restart deployment -n knative-serving |
| 32 | +``` |
| 33 | +When your controllers come back up, they should be running leader-elected. |
| 34 | +At this point, we've configured the controllers to use leader election and we |
| 35 | +can scale the control plane up! |
| 36 | + |
| 37 | +1. Now, you can scale the control plane up. |
| 38 | + |
| 39 | +``` |
| 40 | +kubectl rollouts restart deployment -n knative-serving controller |
| 41 | +``` |
| 42 | + |
| 43 | +## Scaling the control plane |
| 44 | + |
| 45 | +The following serving controller deployments can be scaled up once leader election is enabled: |
| 46 | + |
| 47 | +- `controller` |
| 48 | +- `autoscaler-hpa` |
| 49 | +- `networking-certmanager` |
| 50 | +- `networking-istio` (if Istio is installed) |
| 51 | +- `networking-ns-cert` |
| 52 | + |
| 53 | +``` |
| 54 | +kubectl scale --replicas=2 <deployment-name> |
| 55 | +``` |
0 commit comments