2020-12-05 22:56:28 +01:00
|
|
|
# 2 Node HA Control Plane with external database
|
|
|
|
|
|
|
|
For this configuration we are deploying a highly available control plane
|
|
|
|
composed of two control nodes. This can be achieved with embedded etcd, however
|
|
|
|
etcd ideally has an odd number of nodes.
|
|
|
|
|
|
|
|
The example below will use an external PostgreSQL datastore to store the
|
|
|
|
cluster state information.
|
|
|
|
|
|
|
|
Main guide: https://rancher.com/docs/k3s/latest/en/installation/ha/
|
|
|
|
|
|
|
|
## Architecture
|
|
|
|
|
|
|
|
```text
|
2021-05-15 19:47:27 +02:00
|
|
|
+-------------------+
|
|
|
|
| Load Balancer/VIP |
|
|
|
|
+---------+---------+
|
2020-12-05 22:56:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+------------+ | +------------+
|
|
|
|
| | | | |
|
|
|
|
+--------+ control-01 +<-----+----->+ control-02 |
|
|
|
|
| | | | |
|
|
|
|
| +-----+------+ +------+-----+
|
|
|
|
| | |
|
|
|
|
| +-------------+-------------+
|
|
|
|
| | | |
|
|
|
|
| +------v----+ +-----v-----+ +----v------+
|
|
|
|
| | | | | | |
|
|
|
|
| | worker-01 | | worker-02 | | worker-03 |
|
|
|
|
| | | | | | |
|
|
|
|
| +-----------+ +-----------+ +-----------+
|
|
|
|
|
|
|
|
|
| +-------+ +-------+
|
|
|
|
| | | | |
|
|
|
|
+-------------------> db-01 +--+ db-02 |
|
|
|
|
| | | |
|
|
|
|
+-------+ +-------+
|
|
|
|
```
|
|
|
|
|
|
|
|
### Required Components
|
|
|
|
|
|
|
|
- Load balancer
|
|
|
|
- 2 control plane nodes
|
|
|
|
- 1 or more worker nodes
|
|
|
|
- PostgreSQL Database (replicated, or Linux HA Cluster).
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
|
|
For your control nodes, you will need to instruct the control plane of the
|
2021-05-15 19:47:27 +02:00
|
|
|
PostgreSQL datastore endpoint and set `k3s_registration_address` to be the
|
|
|
|
hostname or IP of your load balancer or VIP.
|
2020-12-05 22:56:28 +01:00
|
|
|
|
|
|
|
Below is the example for PostgreSQL, it is possible to use MySQL or an Etcd
|
|
|
|
cluster as well. Consult the below guide for using alternative datastore
|
|
|
|
endpoints.
|
|
|
|
|
|
|
|
https://rancher.com/docs/k3s/latest/en/installation/datastore/#datastore-endpoint-format-and-functionality
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
---
|
|
|
|
|
|
|
|
k3s_server:
|
|
|
|
datastore-endpoint: postgres://postgres:verybadpass@database:5432/postgres?sslmode=disable
|
2021-02-16 19:02:30 +01:00
|
|
|
node-taint:
|
|
|
|
- "k3s-controlplane=true:NoExecute"
|
2020-12-05 22:56:28 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
Your worker nodes need to know how to connect to the control plane, this is
|
2021-05-15 19:47:27 +02:00
|
|
|
defined by setting `k3s_registration_address` to the hostname or IP address of
|
2020-12-05 22:56:28 +01:00
|
|
|
the load balancer.
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
---
|
|
|
|
|
2021-05-15 19:47:27 +02:00
|
|
|
k3s_registration_address: control.examplek3s.com
|
2020-12-05 22:56:28 +01:00
|
|
|
```
|