Add lb k8s ha guide and fixed install script

This commit is contained in:
Sambo Chea 2021-10-12 20:25:26 +07:00
parent ac0197af58
commit 18a2935104
Signed by: sombochea
GPG Key ID: 3C7CF22A05D95490
3 changed files with 110 additions and 3 deletions

108
LB-K8S-HA.md Normal file
View File

@ -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
```

View File

@ -2,7 +2,7 @@
#### Quick install for kubernetes cluster for worker node #### Quick install for kubernetes cluster for worker node
```shell ```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 ### 1. Download kubectl

View File

@ -62,8 +62,7 @@ kubeadm version
echo "Downloading and setup docker, containerd and tools..." echo "Downloading and setup docker, containerd and tools..."
sudo swapoff -a sudo swapoff -a
wget https://sh.osa.cubetiqs.com/docker-setup.sh curl -s -L https://sh.osa.cubetiqs.com/docker-setup.sh | bash
bash docker-setup.sh
sudo systemctl start docker sudo systemctl start docker
sudo systemctl enable docker sudo systemctl enable docker