From 18a2935104f546e98f1c438f5d9ff10d468b9bcb Mon Sep 17 00:00:00 2001 From: Sambo Chea Date: Tue, 12 Oct 2021 20:25:26 +0700 Subject: [PATCH] Add lb k8s ha guide and fixed install script --- LB-K8S-HA.md | 108 +++++++++++++++++++++++++++++++++ README.md | 2 +- kube-cluster-worker-install.sh | 3 +- 3 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 LB-K8S-HA.md diff --git a/LB-K8S-HA.md b/LB-K8S-HA.md new file mode 100644 index 0000000..0ec3e22 --- /dev/null +++ b/LB-K8S-HA.md @@ -0,0 +1,108 @@ +# Setup and Configuration k8s multiple master (HA) + +- Keepalived +- HAProxy +- Kubernetes + +### Keepalived + +- Install and start service + +```shell +sudo apt-get install keepalived -y +sudo systemctl enable keepalived +sudo systemctl start keepalived +``` + +- Configuration for master nodes +- k8s-master-1 `/etc/keepalived/keepalived.conf` + +```config +global_defs { + notification_email { + sysadmin@cubetiqhost.net + support@cubetiqhost.net + } + notification_email_from k8s-master-1@cubetiqhost.net + smtp_server localhost + smtp_connect_timeout 30 +} + +vrrp_instance VI_1 { + state MASTER + interface ens18 + virtual_router_id 101 + priority 101 + advert_int 1 + authentication { + auth_type PASS + auth_pass 1111 + } + virtual_ipaddress { + 192.168.0.10 + } +} +``` + +- k8s-master-2 (BACKUP) `/etc/keepalived/keepalived.conf` + +```config +global_defs { + notification_email { + sysadmin@cubetiqhost.net + support@cubetiqhost.net + } + notification_email_from k8s-master-2@cubetiqhost.net + smtp_server localhost + smtp_connect_timeout 30 +} + +vrrp_instance VI_1 { + state BACKUP + interface ens18 + virtual_router_id 101 + priority 100 + advert_int 1 + authentication { + auth_type PASS + auth_pass 1111 + } + virtual_ipaddress { + 192.168.0.10 + } +} +``` + +- k8s-master-3 (BACKUP) `/etc/keepalived/keepalived.conf` + +```config +global_defs { + notification_email { + sysadmin@cubetiqhost.net + support@cubetiqhost.net + } + notification_email_from k8s-master-3@cubetiqhost.net + smtp_server localhost + smtp_connect_timeout 30 +} + +vrrp_instance VI_1 { + state BACKUP + interface ens18 + virtual_router_id 101 + priority 100 + advert_int 1 + authentication { + auth_type PASS + auth_pass 1111 + } + virtual_ipaddress { + 192.168.0.10 + } +} +``` + +- Restart all nodes for keepalived service +```shell +sudo systemctl restart keepalived +``` \ No newline at end of file diff --git a/README.md b/README.md index 38b479b..f86feac 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ #### Quick install for kubernetes cluster for worker node ```shell -curl -s -L https://raw.githubusercontent.com/sombochea/kubernetes-installation/main/kube-cluster-worker-install.sh?v=182012102021 | bash +curl -s -L https://raw.githubusercontent.com/sombochea/kubernetes-installation/main/kube-cluster-worker-install.sh?v=121020215 | bash ``` ### 1. Download kubectl diff --git a/kube-cluster-worker-install.sh b/kube-cluster-worker-install.sh index bd646e8..0199894 100755 --- a/kube-cluster-worker-install.sh +++ b/kube-cluster-worker-install.sh @@ -62,8 +62,7 @@ kubeadm version echo "Downloading and setup docker, containerd and tools..." sudo swapoff -a -wget https://sh.osa.cubetiqs.com/docker-setup.sh -bash docker-setup.sh +curl -s -L https://sh.osa.cubetiqs.com/docker-setup.sh | bash sudo systemctl start docker sudo systemctl enable docker