惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
腾讯CDC
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
K
Kaspersky official blog
V
Visual Studio Blog
博客园 - 聂微东
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
云风的 BLOG
云风的 BLOG
T
Tailwind CSS Blog
C
Check Point Blog
H
Heimdal Security Blog
The GitHub Blog
The GitHub Blog
Google Online Security Blog
Google Online Security Blog
P
Proofpoint News Feed
AI
AI
The Register - Security
The Register - Security
SecWiki News
SecWiki News
Help Net Security
Help Net Security
T
Troy Hunt's Blog
V
V2EX
T
Tenable Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Forbes - Security
Forbes - Security
P
Privacy International News Feed
Microsoft Azure Blog
Microsoft Azure Blog
A
About on SuperTechFans
Recorded Future
Recorded Future
C
Cybersecurity and Infrastructure Security Agency CISA
博客园 - 司徒正美
博客园 - 叶小钗
Y
Y Combinator Blog
人人都是产品经理
人人都是产品经理
S
Security @ Cisco Blogs
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
L
LINUX DO - 最新话题
V2EX - 技术
V2EX - 技术
The Cloudflare Blog
Jina AI
Jina AI
T
The Exploit Database - CXSecurity.com
L
Lohrmann on Cybersecurity
Webroot Blog
Webroot Blog
美团技术团队
N
News and Events Feed by Topic
小众软件
小众软件
Google DeepMind News
Google DeepMind News
G
GRAHAM CLULEY
阮一峰的网络日志
阮一峰的网络日志
B
Blog

jobcher on 打工人日志

2023-12-21 打工人日报 2023-12-20 打工人日报 2023-12-19 打工人日报 2023-12-18 打工人日报 2023-12-17 打工人日报 2023-12-16 打工人日报 2023-12-15 打工人日报 2023-12-14 打工人日报 2023-12-13 打工人日报 2023-12-12 打工人日报 2023-12-11 打工人日报 2023-12-10 打工人日报 2023-12-09 打工人日报 2023-12-08 打工人日报 2023-12-07 打工人日报 2023-12-06 打工人日报 2023-12-05 打工人日报 2023-12-04 打工人日报 2023-12-03 打工人日报 2023-12-02 打工人日报 2023-12-01 打工人日报 2023-11-30 打工人日报 2023-11-29 打工人日报 2023-11-28 打工人日报 2023-11-27 打工人日报 2023-11-26 打工人日报 2023-11-25 打工人日报 2023-11-24 打工人日报 2023-11-23 打工人日报 2023-11-22 打工人日报 2023-11-21 打工人日报 2023-11-20 打工人日报 2023-11-19 打工人日报 2023-11-17 打工人日报 2023-11-16 打工人日报 2023-11-15 打工人日报 2023-11-14 打工人日报 2023-11-13 打工人日报 2023-11-12 打工人日报 2023-11-11 打工人日报 2023-11-10 打工人日报 2023-11-09 打工人日报 2023-11-08 打工人日报 2023-11-07 打工人日报 2023-11-06 打工人日报 2023-11-05 打工人日报 2023-11-04 打工人日报 2023-11-03 打工人日报 2023-11-02 打工人日报 2023-11-01 打工人日报 2023-10-31 打工人日报 2023-10-30 打工人日报 2023-10-29 打工人日报 2023-10-28 打工人日报 2023-10-27 打工人日报 2023-10-26 打工人日报 2023-10-25 打工人日报 2023-10-24 打工人日报 2023-10-23 打工人日报 2023-10-22 打工人日报 2023-10-21 打工人日报 2023-10-20 打工人日报 2023-10-19 打工人日报 2023-10-18 打工人日报 2023-10-17 打工人日报 2023-10-16 打工人日报 2023-10-15 打工人日报 2023-10-14 打工人日报 2023-10-13 打工人日报 2023-10-12 打工人日报 2023-10-11 打工人日报 2023-10-10 打工人日报 2023-10-09 打工人日报 2023-10-07 打工人日报 2023-10-06 打工人日报 2023-10-05 打工人日报 2023-10-04 打工人日报 2023-10-03 打工人日报 2023-10-02 打工人日报 2023-10-01 打工人日报 2023-09-30 打工人日报 2023-09-29 打工人日报 2023-09-28 打工人日报 2023-09-27 打工人日报 2023-09-26 打工人日报 2023-09-25 打工人日报 2023-09-24 打工人日报 2023-09-23 打工人日报 2023-09-22 打工人日报 2023-09-21 打工人日报 2023-09-20 打工人日报 2023-09-19 打工人日报 2023-09-18 打工人日报 2023-09-17 打工人日报 2023-09-16 打工人日报 2023-09-15 打工人日报 2023-09-14 打工人日报 2023-09-13 打工人日报 2023-09-12 打工人日报 2023-09-11 打工人日报
Keepalived高可用
2022-01-05 · via jobcher on 打工人日志

Keepalived 高可用

配置文件存放位置:/usr/share/doc/keepalived/samples
VVRP 虚拟路由冗余协议

组成

LB 集群:Load Balancing,负载均衡集群,平均分配给多个节点
HA 集群:High Availability,高可用集群,保证服务可用
HPC 集群:High Performance Computing,高性能集群

配置

keepalived+LVS+nginx

  1. 各节点时间必须同步:ntp, chrony
  2. 关闭防火墙及 SELinux

同步各节点时间

1#安装ntpdate
2yum -y install ntpdate
3#更改时区
4timedatectl set-timezone 'Asia/Shanghai'
5#查看时间
6timedatectl
7datetime

安装 keepalived

1#安装
2yum -y install keepalived

创建 check_apiserver.sh

1# 创建检测脚本
2vim /etc/keepalived/check_apiserver.sh 
 1#!/bin/bash
 2
 3# VIP 地址(你的 Kubernetes apiserver 将通过这个 VIP 暴露)
 4APISERVER_VIP="10.10.10.68" # 设定你自己的vip
 5APISERVER_PORT="6443"
 6
 7errorExit() {
 8  echo "*** $*" 1>&2
 9  exit 1
10}
11
12# 检查 apiserver 的 /healthz
13curl -sf --max-time 3 https://${APISERVER_VIP}:${APISERVER_PORT}/healthz \
14  -k -o /dev/null || errorExit "API Server Unhealthy"

配置master

1vim /etc/keepalived/keepalived.conf
 1vrrp_script chk_apiserver {
 2    script "/etc/keepalived/check_apiserver.sh"
 3    interval 3
 4    weight -10
 5    fall 3
 6    rise 2
 7}
 8
 9vrrp_instance VI_1 {
10    state MASTER
11    interface eth0 # 改为你实际网关
12    virtual_router_id 51
13    priority 120 #master改为最大值
14    advert_int 1
15
16    authentication {
17        auth_type PASS
18        auth_pass 123456 #改为实际的密码
19    }
20
21    virtual_ipaddress {
22        10.10.10.68/24  #改为vip地址
23    }
24
25    track_script {
26        chk_apiserver
27    }
28}

启动keepalived

1systemctl enable keepalived --now
2systemctl status keepalived
3# 检测vip是否正常
4ip a | grep eth0
5ping 10.10.10.68
6curl -k https://10.10.10.68:6443/healthz

配置 backup

1vim /etc/keepalived/keepalived.conf
 1vrrp_script chk_apiserver {
 2    script "/etc/keepalived/check_apiserver.sh"
 3    interval 3
 4    weight -10
 5    fall 3
 6    rise 2
 7}
 8
 9vrrp_instance VI_1 {
10    state BACKUP                   # master2/master3 上改为 BACKUP
11    interface eth0
12    virtual_router_id 51
13    priority 100                   # master2: 100, master3: 90
14    advert_int 1
15
16    authentication {
17        auth_type PASS
18        auth_pass 123456
19    }
20
21    virtual_ipaddress {
22        10.10.10.68/24
23    }
24
25    track_script {
26        chk_apiserver
27    }
28}

启动keepalived

1systemctl enable keepalived --now
2systemctl status keepalived
3# 检测vip是否正常
4ping 10.10.10.68
5curl -k https://10.10.10.68:6443/healthz