关于kubesphere:Centos79多节点安装KubeSphere-v311

3次阅读

共计 1837 个字符,预计需要花费 5 分钟才能阅读完成。

筹备服务器

3 台 Linux 主机,2 核 4G,50G 硬盘

内网 IP(可相互 ssh) hostname
10.206.0.17 master
10.206.0.12 node1
10.206.0.16 node2

初始化装置环境

systemctl stop firewalld
systemctl disable firewalld
sed -i 's/enforcing/disabled/' /etc/selinux/config 
sed -ri 's/.*swap.*/#&/' /etc/fstab
cat > /etc/sysctl.d/k8s.conf << EOF 
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1 
EOF
sysctl --system
yum install ntpdate -y
ntpdate time.windows.com

装置依赖

更新 yum 源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache
yum update -y

#查看以后 yum 源
yum repolist

装置依赖

yum install -y socat
yum install -y conntrack

配置阿里镜像减速

设置仓库地址:https://help.aliyun.com/docum…

cat > /etc/docker/daemon.json << EOF
{"registry-mirrors": ["https://xxx.mirror.aliyuncs.com"] 
}
EOF

增加阿里源

cat > /etc/yum.repos.d/kubernetes.repo << EOF 
[kubernetes] 
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64 
enabled=1 
gpgcheck=0 
epo_gpgcheck=0 
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg 
https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg 
EOF

多节点装置

拉取 KubeKey

export KKZONE=cn

curl -sfL https://get-kk.kubesphere.io | VERSION=v1.1.1 sh -

chmod +x kk

创立配置文件

./kk create config --with-kubernetes v1.20.4 --with-kubesphere v3.1.1

编辑配置文件

apiVersion: kubekey.kubesphere.io/v1alpha1
kind: Cluster
metadata:
  name: sample
spec:
  hosts:
  - {name: master, address: 10.206.0.17, internalAddress: 10.206.0.17, user: root, password: 123456}
  - {name: node1, address: 10.206.0.12, internalAddress: 10.206.0.12, user: root, password: 123456}
  - {name: node2, address: 10.206.0.16, internalAddress: 10.206.0.16, user: root, password: 123456}
  roleGroups:
    etcd:
    - master
    master:
    - master
    worker:
    - node1
    - node2

开始装置

./kk create cluster -f config-sample.yaml

装置实现

参考文档

  1. 多节点装置 KubeSphere
  2. CentOS7 yum 源批改为阿里,配置阿里 epel 源
正文完
 0