Skip to content

Instantly share code, notes, and snippets.

@ohthateverest
Forked from bgulla/rke2_kubevip.md
Last active February 25, 2023 23:59
Show Gist options
  • Select an option

  • Save ohthateverest/b1aac10d2c8ff49bbf19c10b4388f3cd to your computer and use it in GitHub Desktop.

Select an option

Save ohthateverest/b1aac10d2c8ff49bbf19c10b4388f3cd to your computer and use it in GitHub Desktop.
RKE2 api-server HA with Kube-VIP

On-Prem RKE2 api-server HA with Kube-VIP

               ,        ,  _______________________________
   ,-----------|'------'|  |                             |
  /.           '-'    |-'  |_____________________________|
 |/|             |    |    
   |   .________.'----'    _______________________________
   |  ||        |  ||      |                             |
   \__|'        \__|'      |_____________________________|

|‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾|
|________________________________________________________|

|‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾|
|________________________________________________________|

What does this accomplish?

On-premise Kubernetes installations are unable to take advantage of cloud-native services like dynamic load-balancers. In order to ensure highly-available clusters, one must deploy a solution that will enable the Kubernetes API-server to be accessible in the event of node failure. While traditionally this would be accomplished using an on-premise load-balancer such as k8s-deployed metal-lb/nginx, these solutions would not work our case because the api-scheduler would not be available to schedule such deployments... therefore, chicken and the egg.

What is Kube-VIP?

The kube-vip project provides High-Availability and load-balancing for both inside and outside a Kubernetes cluster

Learn more here

TLDR?

watch this video by Adrian

Instructions

Prereqs

In order to proceed with this guide, you will need the following:

  • DNS server or modification of /etc/hosts with the node hostnames and rke2 master HA hostname
  • firewalld turned off

Assumptions

In this guide, I will be setting up a 3-node HA RKE2 cluster. I use the .lol domain but swap out for the domain of your choosing.

Host Type IP Notes
rke2a VM 192.168.1.6 etcd
rke2b VM 192.168.1.7 etcd
rke2c VM 192.168.1.8 etcd
rke2master Virtual-IP 192.168.1.5 You will define this IP on your own. Make sure that it is not currently allocated to a node (and remove from DHCP allocation)

If you do not have a DNS server available/configured, the /etc/hosts file on each node will need to include the following.

rke2a 192.168.1.6
rke2b 192.168.1.7
rke2c 192.168.1.8
rke2master 192.168.1.5

https://baturorkun.medium.com/ha-kubernetes-rke2-with-kube-vip-and-rancher-66129d841678

before installing rancher follow this guide.

https://www.raptorswithhats.com/the-k8s-rabbit/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment