
🌐 Machine-translated from Russian. Show original
In this part:
Cluster diagram
| Node | Role | IP |
|---|
| K8S-S1, K8S-S2, K8S-S3 | Server: Control Plane + etcd (can also run applications) | 192.168.1.41–43 |
| K8S-A1, K8S-A2 | Agent: only applications | 192.168.1.51–52 |
k8s-api.corp.local | a permanent API address | a virtual IP or a |
Why three servers: etcd stores the cluster state and requires quorum — most nodes. Of three, one may fail, of two — none (two are worse than one). The number of servers is always odd.
Requirements for each node: Ubuntu 24.04, unique name, synchronized time (timedatectl), network with low server latency. A fast SSD is needed for etcd — on slow disks, the cluster is unstable.
Servers are conveniently maintained as virtual machines on different physical hosts — otherwise, failure of one hypervisor will drop the quorum. How to prepare VMs — the "Linux server and KVM" series.
Ports between nodes
Read more
🌐 Machine-translated from Russian. Show original
In this part:
Why the remark
- Fast server failure recovery: switching in minutes, not recovering from backup in hours.
- Reading from a replica: reports and analytics do not interfere with the main workload.
- Maintenance with minimal downtime: upgraded replica, switched, upgraded the former main server.
⚠️ A replica does not replace a backup. An incorrect DELETE or DROP TABLE will instantly be repeated on the replica. Backups from part 3 remain mandatory.
How it works
The primary server writes WAL and sends it over the network to standbys that apply changes and are read-only. This is physical stream replication: a replica is an exact copy of a cluster of the same major version.
Stand in the article:
| Role | Name | IP |
|---|
| primary | db01 | 192.168.1.21 |
| standby | db02 | 192.168.1.22 |
On both servers — PostgreSQL 18 from part 1 with the same settings.
Step 1. Main server
Role for replication:
sudo -u postgres psql -c "CREATE ROLE replicator WITH REPLICATION LOGIN;"
sudo -u postgres psql -c "\password replicator"
/etc/postgresql/18/main/conf.d/50-replication.conf:
Read more
🌐 Machine-translated from Russian. Show original
In this part:
Why choose a second provider
If the office has a cash register, 1C over the internet, IP telephony, or cloud services, a break in one channel stops working. The second provider (another operator, another physical channel — for example, fiber + mobile internet) solves the problem.
Simple option: distance and check-gateway
/ip route add dst-address=0.0.0.0/0 gateway=IP_шлюза_ISP1 distance=1 check-gateway=ping
/ip route add dst-address=0.0.0.0/0 gateway=IP_шлюза_ISP2 distance=2 check-gateway=ping
NAT — for both interfaces (both in the WAN list, masquerade rule from part 1.
Limitation: the check-gateway only checks the availability of the provider's gateway. If the gateway responds but there is no further internet — no switching will occur.
Reliable option: recursive routes
We check the availability of an external address through a specific provider:
/ip route add dst-address=1.1.1.1/32 gateway=IP_шлюза_ISP1 scope=10
/ip route add dst-address=8.8.8.8/32 gateway=IP_шлюза_ISP2 scope=10
/ip route add dst-address=0.0.0.0/0 gateway=1.1.1.1 distance=1 check-gateway=ping target-scope=11
/ip route add dst-address=0.0.0.0/0 gateway=8.8.8.8 distance=2 check-gateway=ping target-scope=11
Read more