kubespray部署高可用部署高可用kubernetes集群集群(国内镜像国内镜像)
准备准备
工具工具
https://github.com/kubernetes-sigs/kubespray
kubespray 使用 ansible 快速部署容器化 高可用 k8s 集群
环境环境
主机主机 内网内网ip 外网外网ip 系统系统
k8s-1 10.0.0.18 61.xxx.xxx.187 ubuntu 18.04
k8s-2 10.0.0.19 ubuntu 18.04
k8s-3 10.0.0.20 ubuntu 18.04
规划规划
部署节点部署节点 k8s-1
etcd 节点节点 k8s-1 k8s-2 k8s-3
master 节点节点 k8s-1 k8s-2
node 节点节点 k8s-1 k8s-2 k8s-3
部署部署
默认全部使用 root 用户操作
配置配置 DNS
# 所有节点
vim /etc/hosts
10.0.0.18 k8s-1
10.0.0.19 k8s-2
10.0.0.20 k8s-3
修改修改 apt 源源
# 所有节点
cp /etc/apt/sources.list /etc/apt/sources.list.bakcup
cat > /etc/apt/sources.list <<EOF
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
EOF
apt update
配置配置ssh免密登陆免密登陆
# 在部署节点 k8s-1 上
ssh-keygen
ssh-copy-id k8s-1
ssh-copy-id k8s-2
ssh-copy-id k8s-3
内核升级内核升级
ubuntu 18.04 使用内核 4.15, 达到要求, 不需要更新, 其他系统内核更新参考:
https://github.com/easzlab/kubeasz/blob/master/docs/guide/kernel_upgrade.md
安装依赖安装依赖
# 在所有节点上
apt install -y python2.7
# 下面两行 ubuntu18.04 需要
add-apt-repository universe
apt install apt-transport-https
# 在部署节点 k8s-1 上
apt install -y python3-pip
评论0