Creating High Available Baremetal Kubernetes cluster with Kubeadm and Keepalived (More Simple Guide)

Dec 19, 2018 · 2 min read

Input data

LoadBalancer setup

apt-get -y install keepalived
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 1
priority 100
advert_int 1
authentication {
auth_type AH
auth_pass iech6peeBu6Thoo8xaih
virtual_ipaddress {
systemctl start keepalived
systemctl enable keepalived

Deploying Kubernetes cluster

apt-get -y install kubeadm kubelet kubectl
systemctl stop keepalived

First node

kind: ClusterConfiguration
kubernetesVersion: stable
- ""
controlPlaneEndpoint: ""
kubeadm init --config=kubeadm-config.yaml
NODES="node2 node3"
CERTS=$(find /etc/kubernetes/pki/ -maxdepth 1 -name '*ca.*' -o -name '*sa.*')
ETCD_CERTS=$(find /etc/kubernetes/pki/etcd/ -maxdepth 1 -name '*ca.*')
for NODE in $NODES; do
ssh $NODE mkdir -p /etc/kubernetes/pki/etcd
scp $CERTS $NODE:/etc/kubernetes/pki/
scp $ETCD_CERTS $NODE:/etc/kubernetes/pki/etcd/
scp /etc/kubernetes/admin.conf $NODE:/etc/kubernetes

Second and Third nodes

kubeadm join --token j04n3m.octy8zely83cy2ts --discovery-token-ca-cert-hash sha256:84938d2a22203a8e56a787ec0c6ddad7bc7dbd52ebabc62fd5f4dbea72b14d1f --experimental-control-plane
systemctl start keepalived

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade