一、准备环境
1、准备服务器
master0 :192.168.37.11 centos7.5 + 8cpu + 16G(内存) + 20G(/) + 200G ( data) + 200G(mnt) master1 :192.168.37.12 centos7.5 + 8cpu + 16G(内存) + 20G(/) + 200G ( data) master2 :192.168.37.13 centos7.5 + 8cpu + 16G(内存) + 20G(/) + 200G ( data) node0: 192.168.37.14 centos7.5 + 8cpu + 16G(内存) + 20G(/) + 1T ( data) node1: 192.168.37.15 centos7.5 + 8cpu + 16G(内存) + 20G(/) + 1T ( data) node2: 192.168.37.16 centos7.5 + 8cpu + 16G(内存) + 20G(/) + 1T ( data) node3: 192.168.37.17 centos7.5 + 8cpu + 16G(内存) + 20G(/) + 1T ( data) nfs-server:192.168.18 centos7.5 + 4cpu + 8G(内存) + 20G(/) + 2T ( data)
二、安装工具服务
1、安装jdk1.8
2、安装nfs服务
登陆nfs-server服务器,创建 /data/kubevolume 目录
// 安装nfs:
# yum -y install nfs-utils # vim /etc/exports /data/kubevolume 192.168.37.0/24(rw,no_root_squash)
启动nfs服务
# systemctl start nfs # systemctl enable nfs
三、下载安装kubesphere
1、 离线下载
# curl -L https://kubesphere.io/download/offline/advanced-2.0.2 > advanced-2.0.2.tar.gz # tar -zxf advanced-2.0.2.tar.gz # cd kubesphere-all-offline-advanced-2.0.2/conf
2、 修改配置文件 vars.yml
// 修改配置文件vars.yml 中的nfs配置和all-in-one配置
# vim kubesphere-all-offline-advanced-2.0.2/conf/vars.yml
nfs_client_enable: true nfs_client_is_default_class: true nfs_server: 192.168.37.18 nfs_path: /data/kubevolume local_volume_provisioner_enabled: false //解压后的配置默认是true local_volume_is_default_class: false
3、修改配置文件hosts.ini
# vim kubesphere-all-offline-advanced-2.0.2/conf/hosts.ini
[all] master0 ansible_connection=local ip=192.168.37.11 ansible_ssh_pass=root master1 ansible_host=192.168.37.12 ip=192.168.37.12 ansible_ssh_pass=root master2 ansible_host=192.168.37.13 ip=192.168.37.13 ansible_ssh_pass=root node0 ansible_host=192.168.37.14 ip=192.168.37.14 ansible_ssh_pass=root node1 ansible_host=192.168.37.15 ip=192.168.37.15 ansible_ssh_pass=root node2 ansible_host=192.168.37.16 ip=192.168.37.16 ansible_ssh_pass=root node3 ansible_host=192.168.37.17 ip=192.168.37.17 ansible_ssh_pass=root [local-registry] master0 [kube-master] master0 master1 master2 [kube-node] node0 node1 node2 node3 [etcd] master0 master1 master2 [k8s-cluster:children] kube-node kube-master
4、安装
# cd kubesphere-all-offline-advanced-2.0.2/scripts # ./install.sh 选择选项2
5、metalb外网访问设置
私有云裸金属架构的kubernetes集群不支持LoadBalance
# wget https://raw.githubusercontent.com/google/metallb/v0.7.3/manifests/metallb.yaml # kubectl apply -f metallb.yaml # wget https://raw.githubusercontent.com/google/metallb/v0.7.3/manifests/example-layer2-config.yaml
// 修改ip地址池和集群节点网段相同
[centos@k8s-master ~]$ vim example-layer2-config.yaml
apiVersion: v1 kind: ConfigMap metadata: namespace: metallb-system name: config data: config: | address-pools: - name: default protocol: layer2 addresses: - 192.168.37.20-192.168.37.30
6、istio设置允许容器访问外网
# [root@master0 data]# kubectl edit cm istio-sidecar-injector -n istio-system
“ * ” 表示默认拒绝所有的ip访问外网
将默认的 “ * ” 改为 “ 10.100.0.1/24 ” ,意思是容器拒绝访问外网的ip是: " 10.100.0.1/24
四、注意点
- jdk一定要安装
- 系统版本一定要安装对应的
- docker安装默认数据存放位置是/var/lib/docker,,如果/目录不够大的话,将docker的目录做一个软连接到空间大的磁盘上
- nfs存储:
- 修改vars.yml 中的nfs配置
- 修改/etc/exports,对nfs进行授权
原文链接:https://blog.csdn.net/zhangyan2210/article/details/103034598
原创文章,作者:优速盾-小U,如若转载,请注明出处:https://www.cdnb.net/bbs/archives/6515