Keepalived

  • By Canonical Kubernetes
Channel Revision Published Runs on
latest/stable 48 17 Apr 2024
Ubuntu 22.04 Ubuntu 20.04
latest/candidate 48 15 Apr 2024
Ubuntu 22.04 Ubuntu 20.04
latest/beta 49 17 Apr 2024
Ubuntu 22.04 Ubuntu 20.04
latest/edge 49 16 Apr 2024
Ubuntu 22.04 Ubuntu 20.04
1.30/edge 49 16 Apr 2024
Ubuntu 22.04 Ubuntu 20.04
1.29/stable 48 17 Apr 2024
Ubuntu 22.04 Ubuntu 20.04
1.29/candidate 48 15 Apr 2024
Ubuntu 22.04 Ubuntu 20.04
1.29/beta 49 17 Apr 2024
Ubuntu 22.04 Ubuntu 20.04
1.29/edge 45 21 Aug 2023
Ubuntu 22.04 Ubuntu 20.04
1.28/stable 44 22 Aug 2023
Ubuntu 22.04 Ubuntu 20.04
1.28/candidate 39 07 Jun 2023
Ubuntu 22.04 Ubuntu 20.04
1.28/beta 44 07 Aug 2023
Ubuntu 22.04 Ubuntu 20.04
1.28/edge 45 09 Aug 2023
Ubuntu 22.04 Ubuntu 20.04
1.27/stable 39 12 Jun 2023
Ubuntu 22.04 Ubuntu 20.04
1.27/candidate 39 12 Jun 2023
Ubuntu 22.04 Ubuntu 20.04
1.27/beta 36 09 Apr 2023
Ubuntu 22.04 Ubuntu 20.04
1.27/edge 34 07 Apr 2023
Ubuntu 22.04 Ubuntu 20.04
1.26/stable 33 27 Feb 2023
Ubuntu 22.04 Ubuntu 20.04
1.26/candidate 33 25 Feb 2023
Ubuntu 22.04 Ubuntu 20.04
1.26/beta 28 09 Apr 2023
Ubuntu 22.04 Ubuntu 20.04
1.26/edge 28 19 Nov 2022
Ubuntu 22.04 Ubuntu 20.04
1.25/stable 27 30 Sep 2022
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04
1.25/candidate 27 28 Sep 2022
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04
1.25/beta 29 01 Dec 2022
Ubuntu 22.04 Ubuntu 20.04
1.25/edge 22 09 Sep 2022
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04
1.24/stable 16 04 Aug 2022
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04
1.24/candidate 16 01 Aug 2022
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04
1.24/beta 9 21 Apr 2022
Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04
1.24/edge 15 22 Jul 2022
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04
1.23/beta 5 22 Mar 2022
Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04
1.23/edge 3 24 Feb 2022
Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04
juju deploy keepalived
Show information

Platform:

Ubuntu
22.04 20.04

Keepalived is software which provides high availability by assigning two or more nodes a virtual IP (VIP) and monitoring those nodes, failing over when one goes down.

Usage

The Keepalived charm is a subordinate.

Allocating a VIP and ensuring that it can route to all of the instances is a manual process which depends on your infrastructure. It does require that the VIP be able to route to each instance, and that the VRRP protocol is allowed on the network. While this should be the case on bare metal and MAAS, and can be made to work on OpenStack, it will generally not be possible on public clouds. Thus, in those cases it is generally better to go with a cloud-provided load balancer with health checks, such as Octavia or ELB.

Using with Kubernetes (Charmed Kubernetes)

Use keepalived with Charmed Kubernetes to ensure kubeapi-load-balancer is not a single point of failure.

# These instructions assume you've deployed Charmed Kubernetes already:
# juju deploy charmed-kubernetes

# deploy the keepalived charm
juju deploy cs:~containers/keepalived

# add new keepalived relations
juju relate keepalived:juju-info kubeapi-load-balancer:juju-info
juju relate keepalived:lb-sink kubeapi-load-balancer:website
juju relate keepalived:loadbalancer kubernetes-master:loadbalancer
juju relate keepalived:website kubernetes-worker:kube-api-endpoint

# remove Charmed Kubernetes relations that are no longer needed
juju remove-relation kubernetes-worker:kube-api-endpoint kubeapi-load-balancer:website
juju remove-relation kubernetes-master:loadbalancer kubeapi-load-balancer:loadbalancer


# NOTE: ensure this relation from Charmed Kubernetes is preserved, so that the
# load-balancer knows about backend endpoints
juju relate kubernetes-master:kube-api-endpoint kubeapi-load-balancer:apiserver || true

# configure keepalived (values are examples, substitute your own)
export VIP_HOSTNAME=test.example.com
juju config keepalived virtual_ip=10.10.74.250
juju config keepalived vip_hostname=$VIP_HOSTNAME

# set extra_sans to update api server ssl cert
juju config kubeapi-load-balancer extra_sans=$VIP_HOSTNAME
juju config kubernetes-master extra_sans=$VIP_HOSTNAME

# if you only have one kubeapi-load-balancer unit, add another one
juju add-unit kubeapi-load-balancer

This changes kubelet and kubectl to use the VIP to reach the Kubernetes API server.

Using with HA Proxy

juju deploy cs:~containers/keepalived
juju add-relation haproxy keepalived