首页 > 其他分享 >二进制安装Kubernetes v1.25.0

二进制安装Kubernetes v1.25.0

时间:2022-10-30 00:11:04浏览次数:48  
标签:k8s Kubernetes 二进制 hostname 192.168 v1.25 Ubuntu kube 20.04

前言:因为ecs资源丰富,这回敞开用当回地主,一共使用了8台机器,分别是三台master节点,三台工作节点和两台负载均衡。

1. 部署规划表

hostname

IP

Software

Version

k8s-master01

192.168.17.62

kube-apiserver、kube-controller-manager、kube-scheduler、etcd、
kubelet、kube-proxy、nfs-client

20.04.1-Ubuntu

k8s-master02

192.168.17.55

kube-apiserver、kube-controller-manager、kube-scheduler、etcd、
kubelet、kube-proxy、nfs-client

20.04.1-Ubuntu

k8s-master03

192.168.17.60

kube-apiserver、kube-controller-manager、kube-scheduler、etcd、
kubelet、kube-proxy、nfs-client

20.04.1-Ubuntu

k8s-node01

192.168.17.61

kubelet、kube-proxy、nfs-client

20.04.1-Ubuntu

k8s-node02

192.168.17.59

kubelet、kube-proxy、nfs-client

20.04.1-Ubuntu

k8s-node03

192.168.17.57

kubelet、kube-proxy、nfs-client

20.04.1-Ubuntu

Lb01

192.168.17.56

haproxy、keepalived

20.04.1-Ubuntu

Lb02

192.168.17.58

haproxy、keepalived

20.04.1-Ubuntu

VIP

192.168.17.63

   

版本表:

软件

版本

kernel

5.4.0-125

Ubuntu

20.04.1

kube-apiserver、kube-controller-manager、kube-scheduler、kubelet、kube-proxy

v1.25.0

etcd

v3.5.4

containerd

v1.6.8

cfssl

v1.6.1

cni

v1.1.1

crictl

v1.24.2

haproxy

v1.8.27

keepalived

v2.1.5

网段:

物理主机:192.168.17.0/24

service:10.96.0.0/12

pod:172.16.0.0/12

 

2. 环境准备

# 1. 修改主机名
hostnamectl set-hostname k8s-master01
hostnamectl set-hostname k8s-master02
hostnamectl set-hostname k8s-master03
hostnamectl set-hostname k8s-node01
hostnamectl set-hostname k8s-node02
hostnamectl set-hostname lb01
hostnamectl set-hostname lb02



# 2. 主机名解析
cat >> /etc/hosts <<EOF
192.168.17.62  k8s-master01
192.168.17.55  k8s-master02
192.168.17.60  k8s-master03
192.168.17.61  k8s-node01
192.168.17.59  k8s-node02
192.168.17.57  k8s-node03
192.168.17.56  lb01
192.168.17.58  lb02
EOF

# 3. 禁用 swap
sed -ri 's/.*swap.*/#&/' /etc/fstab
swapoff -a && sysctl -w vm.swappiness=0

# 4. 将桥接的IPv4流量传递到iptables的链 
cat > /etc/sysctl.d/k8s.conf << EOF 
net.bridge.bridge-nf-call-ip6tables = 1 
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system

# 5. 域名解析
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
 
# 6. 进行时间同步(服务端)
apt install chrony -y
cat > /etc/chrony.conf << EOF 
pool ntp.aliyun.com iburst
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
allow 10.0.0.0/24
local stratum 10
keyfile /etc/chrony.keys
leapsectz right/UTC
logdir /var/log/chrony
EOF

systemctl restart chronyd.service ; systemctl enable chronyd.service

# 进行实际同步(客户端)
apt install chrony -y
pool 192.168.1.61 iburst
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
keyfile /etc/chrony.keys
leapsectz right/UTC
logdir /var/log/chrony
EOF
systemctl restart chronyd.service ; systemctl enable chronyd.service

#使用客户端进行验证
chronyc sources -v

# 7. 日志目录
mkdir -p /var/log/kubernetes

 

标签:k8s,Kubernetes,二进制,hostname,192.168,v1.25,Ubuntu,kube,20.04
From: https://www.cnblogs.com/Mercury-linux/p/16840260.html

相关文章