---
title: Charmhub | Deploy Keepalived using Charmhub - The Open Operator Collection
description: Deploy the latest version of Keepalived on any cloud. Failover and monitoring
  daemon for LVS clusters
url: https://charmhub.io/keepalived
---

# Keepalived

[Canonical Kubernetes](https://charmhub.io/publisher/containers "View all packages from Canonical Kubernetes")

* [Canonical Kubernetes](https://charmhub.io/publisher/containers "View all packages from Canonical Kubernetes")

Platform:

24.04

22.04

20.04

18.04

16.04

stable 0bddf8b

```
juju deploy keepalived
```

[Learn to deploy on juju >](https://juju.is/docs/juju/manage-applications)

---

#### Relevant links

* [Contact](mailto:Konstantinos Tsakalozos <kos.tsakalozos@canonical.com>)

---

#### Contacts

##### Maintainers

+ [Konstantinos Tsakalozos](mailto:kos.tsakalozos@canonical.com)
+ [Valentin Boucher](mailto:valentin.boucher@kontron.com)

---

Share your thoughts on this charm with the community on discourse.

[Join the discussion](https://discourse.charmhub.io/)

[Keepalived](http://www.keepalived.org/) 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](https://juju.is/docs/sdk#heading--subordinate-charms).

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](https://medium.com/jexia/virtual-ip-with-openstack-neutron-dd9378a48bdf), 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](https://charmhub.io/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
```

---

[Help improve this document in the forum](https://discourse.charmhub.io/t/keepalived-docs-index/6043) ([guidelines](https://discourse.charmhub.io/t/how-to-write-docs-our-documentation-guidelines-for-contributors/1245)). Last updated 4 years ago.
