kubesphere 安装
kubesphere 多节点安装, 官方文档 多节点安装
节点准备
- master: 192.168.0.1
- node1: 192.168.0.2
以下操作两个节点都要操作, 这里以master节点为例子
设置主机名称
hostnamectl set-hostname master
添加域名解析IP
不是必须
[root@master kubesphere]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 114.114.114.114
设置host映射
[root@master kubesphere]# cat /etc/hosts
192.168.0.1 master
安装kubesphere依赖
yum intall -y socat conntrack ebtables ipset
同步时间
同步时间!!
yum -y install ntp ntpdate
ntpdate time.nist.gov
下载KubeKey
#### 访问不了github
export KKZONE=cn
curl -sfL https://get-kk.kubesphere.io | VERSION=v3.1.1 sh -
## 添加权限
chmod +x kk
## 创建k8s 配置文件
# ./kk create config --with-kubesphere [version],不指定version为最新kubesphere
# --with-kubesphere 一定要带上,不然只会安装k8s,不会安装 kubesphere管理台
./kk create config --with-kubesphere
## 执行完生成 config-sample.yaml
[root@master kubesphere]# ls
config-sample.yaml kk kubekey kubekey-v3.1.1-linux-amd64.tar.gz kubelet
config-sample.yaml 配置文件
apiVersion: kubekey.kubesphere.io/v1alpha2
kind: Cluster
metadata:
name: sample
spec:
hosts:
- {name: master, address: 192.168.226.30, internalAddress: 192.168.0.1, user: root, password: "111111"}
- {name: node1, address: 192.168.226.31, internalAddress: 192.168.0.2, user: root, password: "111111"}
roleGroups:
etcd:
- master
control-plane:
- master
worker:
- node1
# ....只截取了与k8s相关的,其他默认就行,这只指定了一个master和一个worker节点
通过配置文件创建 集群
./kk create cluster -f config-sample.yaml
先做一点集群条件校验, 下载 kubectl 等等,可能网络问题下载不来,自行百度:
_ __ _ _ __
| | / / | | | | / /
| |/ / _ _| |__ ___| |/ / ___ _ _
| \| | | | '_ \ / _ \ \ / _ \ | | |
| |\ \ |_| | |_) | __/ |\ \ __/ |_| |
\_| \_/\__,_|_.__/ \___\_| \_/\___|\__, |
__/ |
|___/
14:26:38 CST [GreetingsModule] Greetings
14:26:38 CST message: [node1]
Greetings, KubeKey!
14:26:38 CST message: [master]
Greetings, KubeKey!
14:26:38 CST success: [node1]
14:26:38 CST success: [master]
14:26:38 CST [NodePreCheckModule] A pre-check on nodes
14:26:39 CST success: [master]
14:26:39 CST success: [node1]
14:26:39 CST [ConfirmModule] Display confirmation form
This is a simple check of your environment.
Before installation, ensure that your machines meet all requirements specified at
https://github.com/kubesphere/kubekey#requirements-and-recommendations
Continue this installation? [yes/no]: yes
14:26:45 CST success: [LocalHost]
14:26:45 CST [NodeBinariesModule] Download installation binaries
14:26:45 CST message: [localhost]
downloading amd64 kubeadm v1.23.15 ...
安装成功:
00:19:36 CST success: [master]
#####################################################
### Welcome to KubeSphere! ###
#####################################################
Console: http://192.168.0.1:30880
Account: admin
Password: P@88w0rd
NOTES:
1. After you log into the console, please check the
monitoring status of service components in
"Cluster Management". If any service is not
ready, please wait patiently until all components
are up and running.
2. Please change the default password after login.
#####################################################
https://kubesphere.io 2024-04-27 00:46:49
#####################################################
00:46:52 CST success: [master]
00:46:52 CST Pipeline[CreateClusterPipeline] execute successfully
Installation is complete.
Please check the result using the command:
问题
安装过程网络下载不下来
# kubernetes-release.pek3b.qingstor.com ping 不通
kubernetes-release.pek3b.qingstor.com
处理方案:
# 在 /etc/hosts 增加ip解析
[root@master kubesphere]# cat /etc/hosts
139.198.8.201 kubernetes-release.pek3b.qingstor.com
good luck!