kubernetes: Configure keepalived on control plane

Control plane nodes will now run _keepalived_, to provide a "floating"
IP address that is assigned to one of the nodes at a time.  This
address (172.30.0.169) is now the target of the DNS A record for
_kubernetes.pyrocufflink.blue_, so clients will always communicate with
the server that currently holds the floating address, whichever that may
be.

I was originally inspired by the official Kubernetes [High Availability
Considerations][0] document when designing this.  At first, I planned to
deploy _keepalived_ and HAProxy as DaemonSets on the control plane
nodes, but this ended up being somewhat problematic whenever all of the
control plane nodes would go down at once, as the _keepalived_ and
HAProxy pods would not get scheduled and thus no clients communicate
with the API servers.

[0]: 9d7cfab6fe/docs/ha-considerations.md
unifi-restore
Dustin 2025-07-22 09:00:53 -05:00
parent f62b11bb9d
commit 381ffe7112
2 changed files with 24 additions and 0 deletions

View File

@ -1,2 +1,23 @@
collectd_processes: '{{ collectd_processes_kubelet + collectd_processes_controller}}' collectd_processes: '{{ collectd_processes_kubelet + collectd_processes_controller}}'
dnf_automatic_reboot: never dnf_automatic_reboot: never
keepalived_global_defs: |-
max_auto_priority 79
vrrp_track_process:
kube-apiserver: |-
process kube-apiserver
weight 90
vrrp_instance:
kube-apiserver: |-
state BACKUP
priority ${_RANDOM 1 100}
interface {{ ansible_default_ipv4.interface }}
virtual_router_id 49
virtual_ipaddress {
172.30.0.169/27
}
track_process {
kube-apiserver
}

View File

@ -1,5 +1,8 @@
- hosts: k8s-controller - hosts: k8s-controller
roles: roles:
- role: keepalived
tags:
- keepalived
- role: kubelet - role: kubelet
- hosts: k8s-node - hosts: k8s-node