
正文
kubesphere集群搭建(多节点)
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
kubesphere官网:https://kubesphere.io/docs/advanced-v2.0/zh-CN/introduction/intro/
一、准备环境1、准备服务器master1 :192.168.37.11 centos7.5 + 8cpu + 16G(内存) + 20G(/) + 200G ( data) + 200G(mnt)
master2 :192.168.37.12centos7.5 + 8cpu + 16G(内存) + 20G(/) + 200G ( data)
master3 :192.168.37.13centos7.5 + 8cpu + 16G(内存) + 20G(/) + 200G ( data)
node1:192.168.37.14centos7.5 + 8cpu + 16G(内存) + 20G(/) + 1T ( data)
node2:192.168.37.15centos7.5 + 8cpu + 16G(内存) + 20G(/) + 1T ( data)
node3:192.168.37.16centos7.5 + 8cpu + 16G(内存) + 20G(/) + 1T ( data)
node4:192.168.37.17centos7.5 + 8cpu + 16G(内存) + 20G(/) + 1T ( data)
nfs-server:192.168.18centos7.5 + 4cpu + 8G(内存) + 20G(/) + 2T ( data)
2、安装工具服务
master1 :192.168.37.11 centos7.5 + 8cpu + 16G(内存) + 20G(/) + 200G ( data) + 200G(mnt)
master2 :192.168.37.12centos7.5 + 8cpu + 16G(内存) + 20G(/) + 200G ( data)
master3 :192.168.37.13centos7.5 + 8cpu + 16G(内存) + 20G(/) + 200G ( data)
node1:192.168.37.14centos7.5 + 8cpu + 16G(内存) + 20G(/) + 1T ( data)
node2:192.168.37.15centos7.5 + 8cpu + 16G(内存) + 20G(/) + 1T ( data)
node3:192.168.37.16centos7.5 + 8cpu + 16G(内存) + 20G(/) + 1T ( data)
node4:192.168.37.17centos7.5 + 8cpu + 16G(内存) + 20G(/) + 1T ( data)
nfs-server:192.168.18centos7.5 + 4cpu + 8G(内存) + 20G(/) + 2T ( data)
2、安装工具服务
(1)安装jdk1.8
(2)安装nfs服务 (后面需要修改vas.yml文件中的配置)
登陆nfs-server服务器:
// 安装nfs:
# yum -y install nfs-utils
# vim /etc/exports
/opt/kubesphere 192.168.37.0/(rw,no_root_squash)//启动nfs服务
#systemctl start nfs
#systemctl enable nfs
二、下载安装kubesphere1、离线下载curl -L https://kubesphere.io/download/offline/advanced-2.0.2 > advanced-2.0.2.tar.gz
tar -zxf advanced-2.0..tar.gz
cd kubesphere-all-offline-advanced-2.0./conf
2、 修改配置文件 vars.yml// 修改配置文件vars.yml 中的nfs配置和all-in-one配置# vim kubesphere-all-offline-advanced-2.0./conf/vars.yml
nfs_client_enable: true
nfs_client_is_default_class: true
nfs_server: 192.168.37.18
nfs_path: /opt/kubesphere
local_volume_provisioner_enabled: false
local_volume_is_default_class: false
3、修改配置文件hosts.ini# vim kubesphere-all-offline-advanced-2.0.2/conf/hosts.ini[all]
master1 ansible_connection=local ip=192.168.37.11 ansible_ssh_pass=root
master2 ansible_host=192.168.37.12 ip=192.168.37.12 ansible_ssh_pass=root
master3 ansible_host=192.168.37.13 ip=192.168.37.13 ansible_ssh_pass=root
node1 ansible_host=192.168.37.167 ip=192.168.37.167 ansible_ssh_pass=root
node2 ansible_host=192.168.37.167 ip=192.168.37.167 ansible_ssh_pass=root
node2 ansible_host=192.168.37.167 ip=192.168.37.167 ansible_ssh_pass=root
node2 ansible_host=192.168.37.167 ip=192.168.37.167 ansible_ssh_pass=root
[local-registry]master1
[kube-master]
master1
master2
master3
[kube-node]
node1
node2
node3
node4
[etcd]
master1
master2
master3
[k8s-cluster:children]
kube-node
kube-master
4、配置docker安装
由于docker占用空间较大,将docker软连接到挂载了大磁盘的 data 目录下
mkdir -p /data/docker
mkdir -p /data/kubelet
ln -sf /data/docker /var/lib/docker
ln -sf /data/kubelet /var/lib/kubelet
添加一个daemon.json文件:
# mkdir -p /etc/docker
# vim /etc/docker/daemon.json
{
"bip": "10.20.0.1/16",
"fixed-cidr": "10.20.0.0/16",
"mtu":
}
mnt目录挂载一个大磁盘的原因是,docker的registry默认的安装目录是 /mnt 。。
5、安装# cd kubesphere-all-offline-advanced-2.0.2/scripts# ./install.sh看到以下内容说明安装成功:successsful!
#####################################################
### Welcome to KubeSphere! ###
#####################################################
Console: http://192.168.37.11:30880
Account: admin
Password: P@88w0rd
NOTE:
1. After log in to console, please verify the
monitoring status of service components in
the "Cluster Status". If the service is not
ready, please wait patiently. You can start
to use when all components are totally ready.
2. Please modify the default password after login.
#####################################################
5、注意1、系统版本一定要安装对应的2、docker安装默认数据存放位置是/var/lib/docker,,如果/目录不够大的话,将docker的目录做一个软连接到空间大的磁盘上3、nfs存储:(1)修改vars.yml 中的nfs配置(2)修改/etc/exports,对nfs进行授权(3)启动nfs服务 三、测试kubesphere集群
1、web端登陆:
输入“ http://192.168.37.11:30880 ” ,进入登陆界面,

登陆的用户名和密码是成功安装系统时默认给出的
Console: http://192.168.37.11:30880
Account: admin
Password: P@88w0rd
2、进入服务修改登陆密码,测试集群的node是否可用。
curl -L https://kubesphere.io/download/offline/advanced-2.0.2 > advanced-2.0.2.tar.gz
tar -zxf advanced-2.0..tar.gz
cd kubesphere-all-offline-advanced-2.0./conf
2、 修改配置文件 vars.yml// 修改配置文件vars.yml 中的nfs配置和all-in-one配置# vim kubesphere-all-offline-advanced-2.0./conf/vars.yml
nfs_client_enable: true
nfs_client_is_default_class: true
nfs_server: 192.168.37.18
nfs_path: /opt/kubesphere
local_volume_provisioner_enabled: false
local_volume_is_default_class: false
3、修改配置文件hosts.ini# vim kubesphere-all-offline-advanced-2.0.2/conf/hosts.ini[all]
master1 ansible_connection=local ip=192.168.37.11 ansible_ssh_pass=root
master2 ansible_host=192.168.37.12 ip=192.168.37.12 ansible_ssh_pass=root
master3 ansible_host=192.168.37.13 ip=192.168.37.13 ansible_ssh_pass=root
node1 ansible_host=192.168.37.167 ip=192.168.37.167 ansible_ssh_pass=root
node2 ansible_host=192.168.37.167 ip=192.168.37.167 ansible_ssh_pass=root
node2 ansible_host=192.168.37.167 ip=192.168.37.167 ansible_ssh_pass=root
node2 ansible_host=192.168.37.167 ip=192.168.37.167 ansible_ssh_pass=root
[local-registry]master1
[kube-master]
master1
master2
master3
[kube-node]
node1
node2
node3
node4
[etcd]
master1
master2
master3
[k8s-cluster:children]
kube-node
kube-master
4、配置docker安装
由于docker占用空间较大,将docker软连接到挂载了大磁盘的 data 目录下
mkdir -p /data/docker
mkdir -p /data/kubelet
ln -sf /data/docker /var/lib/docker
ln -sf /data/kubelet /var/lib/kubelet
添加一个daemon.json文件:
# mkdir -p /etc/docker
# vim /etc/docker/daemon.json
{
"bip": "10.20.0.1/16",
"fixed-cidr": "10.20.0.0/16",
"mtu":
}
mnt目录挂载一个大磁盘的原因是,docker的registry默认的安装目录是 /mnt 。。
5、安装# cd kubesphere-all-offline-advanced-2.0.2/scripts# ./install.sh看到以下内容说明安装成功:successsful!
#####################################################
### Welcome to KubeSphere! ###
#####################################################
Console: http://192.168.37.11:30880
Account: admin
Password: P@88w0rd
NOTE:
1. After log in to console, please verify the
monitoring status of service components in
the "Cluster Status". If the service is not
ready, please wait patiently. You can start
to use when all components are totally ready.
2. Please modify the default password after login.
#####################################################
5、注意1、系统版本一定要安装对应的2、docker安装默认数据存放位置是/var/lib/docker,,如果/目录不够大的话,将docker的目录做一个软连接到空间大的磁盘上3、nfs存储:(1)修改vars.yml 中的nfs配置(2)修改/etc/exports,对nfs进行授权(3)启动nfs服务 三、测试kubesphere集群
1、web端登陆:
输入“ http://192.168.37.11:30880 ” ,进入登陆界面,

登陆的用户名和密码是成功安装系统时默认给出的
Console: http://192.168.37.11:30880
Account: admin
Password: P@88w0rd
2、进入服务修改登陆密码,测试集群的node是否可用。
# vim kubesphere-all-offline-advanced-2.0./conf/vars.yml
nfs_client_enable: true
nfs_client_is_default_class: true
nfs_server: 192.168.37.18
nfs_path: /opt/kubesphere
local_volume_provisioner_enabled: false
local_volume_is_default_class: false
# vim kubesphere-all-offline-advanced-2.0.2/conf/hosts.ini
[all]
master1 ansible_connection=local ip=192.168.37.11 ansible_ssh_pass=root
master2 ansible_host=192.168.37.12 ip=192.168.37.12 ansible_ssh_pass=root
master3 ansible_host=192.168.37.13 ip=192.168.37.13 ansible_ssh_pass=root
node1 ansible_host=192.168.37.167 ip=192.168.37.167 ansible_ssh_pass=root
node2 ansible_host=192.168.37.167 ip=192.168.37.167 ansible_ssh_pass=root
node2 ansible_host=192.168.37.167 ip=192.168.37.167 ansible_ssh_pass=root
node2 ansible_host=192.168.37.167 ip=192.168.37.167 ansible_ssh_pass=root
[local-registry]master1
[kube-master]
master1
master2
master3
[kube-node]
node1
node2
node3
node4
[etcd]
master1
master2
master3
[k8s-cluster:children]
kube-node
kube-master
4、配置docker安装
由于docker占用空间较大,将docker软连接到挂载了大磁盘的 data 目录下
mkdir -p /data/docker
mkdir -p /data/kubelet
ln -sf /data/docker /var/lib/docker
ln -sf /data/kubelet /var/lib/kubelet
添加一个daemon.json文件:
# mkdir -p /etc/docker
# vim /etc/docker/daemon.json
{
"bip": "10.20.0.1/16",
"fixed-cidr": "10.20.0.0/16",
"mtu":
}
mnt目录挂载一个大磁盘的原因是,docker的registry默认的安装目录是 /mnt 。。
5、安装# cd kubesphere-all-offline-advanced-2.0.2/scripts# ./install.sh看到以下内容说明安装成功:successsful!
#####################################################
### Welcome to KubeSphere! ###
#####################################################
Console: http://192.168.37.11:30880
Account: admin
Password: P@88w0rd
NOTE:
1. After log in to console, please verify the
monitoring status of service components in
the "Cluster Status". If the service is not
ready, please wait patiently. You can start
to use when all components are totally ready.
2. Please modify the default password after login.
#####################################################
5、注意1、系统版本一定要安装对应的2、docker安装默认数据存放位置是/var/lib/docker,,如果/目录不够大的话,将docker的目录做一个软连接到空间大的磁盘上3、nfs存储:(1)修改vars.yml 中的nfs配置(2)修改/etc/exports,对nfs进行授权(3)启动nfs服务 三、测试kubesphere集群
1、web端登陆:
输入“ http://192.168.37.11:30880 ” ,进入登陆界面,

登陆的用户名和密码是成功安装系统时默认给出的
Console: http://192.168.37.11:30880
Account: admin
Password: P@88w0rd
2、进入服务修改登陆密码,测试集群的node是否可用。
successsful!
#####################################################
### Welcome to KubeSphere! ###
#####################################################Console: http://192.168.37.11:30880
Account: admin
Password: P@88w0rdNOTE:
1. After log in to console, please verify the
monitoring status of service components in
the "Cluster Status". If the service is not
ready, please wait patiently. You can start
to use when all components are totally ready.
2. Please modify the default password after login.
#####################################################
1、系统版本一定要安装对应的
2、docker安装默认数据存放位置是/var/lib/docker,,如果/目录不够大的话,将docker的目录做一个软连接到空间大的磁盘上
3、nfs存储:
(1)修改vars.yml 中的nfs配置
(2)修改/etc/exports,对nfs进行授权
(3)启动nfs服务
三、测试kubesphere集群
1、web端登陆:
输入“ http://192.168.37.11:30880 ” ,进入登陆界面,

登陆的用户名和密码是成功安装系统时默认给出的
Console: http://192.168.37.11:30880
Account: admin
Password: P@88w0rd
2、进入服务修改登陆密码,测试集群的node是否可用。







