add kubespray to the XTesting as it provides newer version of kubenetes and can be...
[it/test.git] / XTesting / kubespray / docs / recover-control-plane.md
1
2 # Recovering the control plane
3
4 To recover from broken nodes in the control plane use the "recover\-control\-plane.yml" playbook.
5
6 * Backup what you can
7 * Provision new nodes to replace the broken ones
8 * Place the surviving nodes of the control plane first in the "etcd" and "kube\_control\_plane" groups
9 * Add the new nodes below the surviving control plane nodes in the "etcd" and "kube\_control\_plane" groups
10
11 Examples of what broken means in this context:
12
13 * One or more bare metal node(s) suffer from unrecoverable hardware failure
14 * One or more node(s) fail during patching or upgrading
15 * Etcd database corruption
16 * Other node related failures leaving your control plane degraded or nonfunctional
17
18 __Note that you need at least one functional node to be able to recover using this method.__
19
20 ## Runbook
21
22 * Move any broken etcd nodes into the "broken\_etcd" group, make sure the "etcd\_member\_name" variable is set.
23 * Move any broken control plane nodes into the "broken\_kube\_control\_plane" group.
24
25 Then run the playbook with ```--limit etcd,kube_control_plane``` and increase the number of ETCD retries by setting ```-e etcd_retries=10``` or something even larger. The amount of retries required is difficult to predict.
26
27 When finished you should have a fully working control plane again.
28
29 ## Recover from lost quorum
30
31 The playbook attempts to figure out it the etcd quorum is intact. If quorum is lost it will attempt to take a snapshot from the first node in the "etcd" group and restore from that. If you would like to restore from an alternate snapshot set the path to that snapshot in the "etcd\_snapshot" variable.
32
33 ```-e etcd_snapshot=/tmp/etcd_snapshot```
34
35 ## Caveats
36
37 * The playbook has only been tested with fairly small etcd databases.
38 * If your new control plane nodes have new ip addresses you may have to change settings in various places.
39 * There may be disruptions while running the playbook.
40 * There are absolutely no guarantees.
41
42 If possible try to break a cluster in the same way that your target cluster is broken and test to recover that before trying on the real target cluster.