CentOS 7.6多master高可用K8s 1.16.2部署教程:Keepalived+Haproxy

需积分: 0 1 下载量 67 浏览量 更新于2024-08-05 收藏 622KB PDF 举报
本文档详细介绍了如何在 CentOS 7.6 系统上部署 Kubernetes v1.16.2 的多master节点高可用架构,涉及的组件包括 Keepalived 和 HAProxy。首先,我们来概述一下架构的关键组成部分: 1. **系统环境**: - CentOS 7.6 操作系统 - 内核版本:3.10.0-1062.4.1.el7.x86_64 - Kubernetes 版本:v1.16.2 - Docker CE 版本:19.03 - 推荐硬件配置:至少2核4GB 2. **高可用与负载均衡**: - 使用 Keepalived 实现 API 服务器的 IP 高可用,确保服务即使在一台节点故障后也能自动切换。 - HAProxy 负责 Kubernetes API 服务器的负载均衡,通过将流量分散到多个 master 节点,提高系统的整体可用性和性能。 3. **部署前准备工作**: - 关闭 selinux 和防火墙,增强系统的安全性并允许所需的网络通信: - 临时禁用 selinux:`sed -ri 's/(SELINUX=).*#\1disabled/#&/' /etc/selinux/config` - 关闭 firewalld 并停止服务:`systemctl disable firewalld && systemctl stop firewalld` - 永久性关闭 swap 以优化内存使用:修改 `/etc/fstab`,注释掉 swap 相关行。 - 添加主机名解析记录,便于主机之间的通信: - 在每个节点上更新 `/etc/hosts` 文件,指定 IP 地址和主机名。 - 创建并分发 SSH 密钥,以便无密码登录: - 生成 SSH 密钥对并在 k8s-110 节点上执行。 - 分发 k8s-110 的公钥到其他节点。 - 配置内核参数以支持桥接网络功能: - 编辑 `/etc/sysctl.d/k8s.conf`,设置 `net.bridge.bridge-nf-call-iptables` 和 `net.bridge.bridge-nf-call-ip6tables` 为 1。 - 定义节点角色、IP地址、安装的软件包以及 VIP 地址,每个 master 节点有独特的设置。 4. **具体操作步骤**: - 对每个 master 节点(k8s-110, k8s-111, k8s-112)进行以下操作: - 安装必要的软件包:kubeadm、kubelet、kubectl、docker、haproxy 和 keepalived。 - 配置节点角色和 IP 地址,确保节点识别其身份和功能。 通过这些步骤,您将能够在 CentOS 7.6 环境中搭建一个具备高可用性的 Kubernetes v1.16.2 集群,确保了API服务的稳定运行和负载均衡。这个过程涉及到基础的系统配置、网络设置以及安全策略的调整,是集群管理的基础任务。

pip install numpy==1.23.0 WARNING: The directory '/root/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag. Looking in indexes: https://mirrors.aliyun.com/pypi/simple/, https://pypi.tuna.tsinghua.edu.cn/simple/, https://pypi.douban.com/simple, https://pypi.mirrors.ustc.edu.cn/simple/ ERROR: Ignored the following versions that require a different python version: 1.22.0 Requires-Python >=3.8; 1.22.1 Requires-Python >=3.8; 1.22.2 Requires-Python >=3.8; 1.22.3 Requires-Python >=3.8; 1.22.4 Requires-Python >=3.8; 1.23.0 Requires-Python >=3.8; 1.23.0rc1 Requires-Python >=3.8; 1.23.0rc2 Requires-Python >=3.8; 1.23.0rc3 Requires-Python >=3.8; 1.23.1 Requires-Python >=3.8; 1.23.2 Requires-Python >=3.8; 1.23.3 Requires-Python >=3.8; 1.23.4 Requires-Python >=3.8; 1.23.5 Requires-Python >=3.8; 1.24.0 Requires-Python >=3.8; 1.24.0rc1 Requires-Python >=3.8; 1.24.0rc2 Requires-Python >=3.8; 1.24.1 Requires-Python >=3.8; 1.24.2 Requires-Python >=3.8; 1.24.3 Requires-Python >=3.8; 1.24.4 Requires-Python >=3.8; 1.25.0 Requires-Python >=3.9; 1.25.0rc1 Requires-Python >=3.9; 1.25.1 Requires-Python >=3.9 ERROR: Could not find a version that satisfies the requirement numpy==1.23.0 (from versions: 1.3.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.7.1, 1.7.2, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.10.0.post2, 1.10.1, 1.10.2, 1.10.4, 1.11.0, 1.11.1, 1.11.2, 1.11.3, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 1.13.3, 1.14.0, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.14.5, 1.14.6, 1.15.0, 1.15.1, 1.15.2, 1.15.3, 1.15.4, 1.16.0, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5, 1.16.6, 1.17.0, 1.17.1, 1.17.2, 1.17.3, 1.17.4, 1.17.5, 1.18.0, 1.18.1, 1.18.2, 1.18.3, 1.18.4, 1.18.5, 1.19.0, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.19.5, 1.20.0, 1.20.1, 1.20.2, 1.20.3, 1.21.0, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6) ERROR: No matching distribution found for numpy==1.23.0 Note: you may need to restart the kernel to use updated packages.

2023-07-13 上传