1.准备部署环境
master 192.168.40.162
node 192.168.40.220
2.下载部署包(从192.168.40.33复制部署包)
scp /opt/kylincloud2_2.0_ft2000_v0.0.1.13_20200511.tar.gz [email protected]:/opt/
3.免密认证
通过192.168.40.192对192.168.40.162及192.168.40.220做免密认证,即master节点对自身及所有node节点做免密认证
(1)ssh-keygen -t rsa
(2)cat id_rsa.pub>>authorized_keys
(3)chmod 710 authorized_keys
(4)scp -r authorized_keys [email protected]:~/.ssh
4.时间同步
(1)ntpdate 192.168.40.253(此命令分别执行在master及node)
将192.168.40.162和192.168.40.220统一与192.168.40.253时间保持一致,即master及所有节点保持统一一致时间
(2)hwclock -w(此命令分别执行在master及node)
将软件时间写入硬件时间,硬件时间是BIOS的时间
5.根据需求修改default.yaml文件
示例一:(全部配置内容)
install_path: /opt/cms/kylincloud2 #安装目录
modules:
etcd: etcd-3.3.13
docker: docker-17.03
kube: kube-1.14.2
keepalived: keepalived-1.3.5
cni: cni-arm64
cfssl: cfssl-1.3.2
cluster info
clustername: kubernetes-phk
clusteruser: kubernetes-admin
docker_registry
registry:
domain: kylincloud2.hub
admin_password: Harbor12345
db:
host: mysql
port: 3306
user: root
passwd: root123
clair_password: password
ntp
ntpserver: 192.168.40.253
nfs 不能注释,永远为最新的nfs服务端信息
nfs_server: 192.168.40.253
src_path: /mnt/nfs/testphk
storage: 192.168.40.253:/mnt/nfs/testphk /nas nfs defaults 0 1
mount_path: /nas
etcd cluster name
etcdname: kube-etcd
head -c 16 /dev/urandom | od -An -t x | tr -d ' '
bootstrap_token: c30302226d4b810e08731702d3890f51
ui_url: ui.kylincloud2.hub
head -c 32 /dev/urandom | base64
encryption_token: d/FP5wCz8lV9s+bU1tnvsuj9C4hZWZRcMVud18E0LMc=
cloudapiserver
dnsserver: 192.168.40.32
dnsport: 9999
NET
vip: 192.168.40.33 #单控模式为 master的ip,多控模式下为虚拟ip,跟集群同网段且不被占用
oldvip: 192.168.17.222 #默认注释掉,当使用 --ip参数时需要将历史的vip地址写入
virtual_router_id: 88 #keepalived 集群通信的心跳值,确保不跟网段中其他keepalived集群的心跳值一致即可
service:
cidr: 10.10.0.0/16
DNS_ip: 10.10.1.10
cluster_domain: cluster.local
pod_net:
cidr: 10.244.0.0/16
部署模式为单控,以及多控不需要lvs的时候注释
lvs:
- name: lvs-1
ip: 192.168.40.207
state: MASTER
- name: lvs-2
ip: 192.168.40.208
state: BACKUP
master:
- name: master1
ip: 192.168.40.33 #第一个ip必须是执行脚本所在的机器
- name: master2
ip: 192.168.40.161
- name: master3
ip: 192.168.40.162
nodes:
- name: node-1
ip: 192.168.40.34
label: rack=bgpt
- name: node-2
ip: 192.168.40.223
label: rack=bgpt1
- name: node-3
ip: 192.168.40.35
label: rack=bgpt1
- name: node-4
ip: 192.168.40.224
label: rack=bgpt
- name: node-5
ip: 192.168.40.207
label: rack=bgpt
- name: node-6
ip: 192.168.40.208
label: rack=bgpt1
新加计算节点,初次部署注释即可
addnodes:
- name: node-3
ip: 192.168.40.35
label: rack=bgpt
- name: node-4
ip: 192.168.40.208
label: rack=bgpt1
示例二:(本次部署所需配置)
install_path: /opt/cms/kylincloud2 #安装目录
modules:
etcd: etcd-3.3.13
docker: docker-17.03
kube: kube-1.14.2
keepalived: keepalived-1.3.5
cni: cni-arm64
cfssl: cfssl-1.3.2
cluster info
clustername: kubernetes
clusteruser: kubernetes-admin
docker_registry
registry:
domain: kylincloud2.hub
admin_password: Harbor12345
db:
host: mysql
port: 3306
user: root
passwd: root123
clair_password: password
ntp
ntpserver: 192.168.40.253
nfs 不能注释,永远为最新的nfs服务端信息
nfs_server: 192.168.40.253
src_path: /mnt/nfs/testphk
storage: 192.168.40.253:/mnt/nfs/testphk /nas nfs defaults 0 1
mount_path: /nas
etcd cluster name
etcdname: kube-etcd
head -c 16 /dev/urandom | od -An -t x | tr -d ' '
bootstrap_token: c30302226d4b810e08731702d3890f51
ui_url: ui.kylincloud2.hub
head -c 32 /dev/urandom | base64
encryption_token: d/FP5wCz8lV9s+bU1tnvsuj9C4hZWZRcMVud18E0LMc=
cloudapiserver
dnsserver: 192.168.40.162
dnsport: 9999
NET
vip: 192.168.40.162 #单控模式为 master的ip,多控模式下为虚拟ip,跟集群同网段且不被占用
oldvip: 192.168.17.222 #默认注释掉,当使用 --ip参数时需要将历史的vip地址写入
virtual_router_id: 41 #keepalived 集群通信的心跳值,确保不跟网段中其他keepalived集群的心跳值一致即可
service:
cidr: 10.10.0.0/16
DNS_ip: 10.10.1.10
cluster_domain: cluster.local
pod_net:
cidr: 10.244.0.0/16
master:
- name: master1
ip: 192.168.40.162 #第一个ip必须是执行脚本所在的机器
nodes: - name: node-1
ip: 192.168.40.220
label: rack=bgpt
6.开始部署
./install --master
7.验证部署是否成功
kubectl get po -A -o wide