KubeSphere安装教程(ubuntu)
# 首先配置ubuntu root登录
# 非root
sudo apt-get install openssh-server
vim /etc/ssh/sshd_config
PermitRootLogin=yes
# 设置密码
sudo passwd root
# 重启服务
sudo systemctl restart ssh
# 开放端口
ufw allow 22
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
# ssh免登录
# 每个服务器分别执行
ssh-keygen -t rsa
# 自身ip也要进行授权
# 乌班图默认不能root登录,因此执行下面的命令之前需要允许root登录
ssh-copy-id -i /root/.ssh/id_rsa.pub 192.168.12.71
1
2
3
4
5
6
2
3
4
5
6
# 安装docker
# 安装
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
# 配置
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://hfjd8n91.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
# 安装依赖
# 环境依赖
sudo apt install curl socat conntrack ebtables ipset
# hostname
hostnamectl set-hostname kbmaster
1
2
3
4
5
2
3
4
5
# 环境配置
# 关闭防火墙
ufw disable
# getenforce
应该处于 Disable 状态
1
2
3
4
5
2
3
4
5
# AllInOn安装
export KKZONE=cn
curl -sfL https://get-kk.kubesphere.io | VERSION=v3.0.7 sh -
chmod +x kk
./kk create cluster --with-kubernetes v1.22.12 --with-kubesphere v3.3.2
1
2
3
4
2
3
4
# 添加节点
注意在 root 用户下安装
# ./kk add nodes -f node.yaml
apiVersion: kubekey.kubesphere.io/v1alpha2
kind: Cluster
metadata:
name: sample
spec:
hosts:
# 使用这种方式也可以 推荐
# - {name: kbslave1, address: 10.6.16.32, internalAddress: 10.6.16.32, privateKeyPath: "~/.ssh/id_rsa" }
- { name: kbslave1, address: 10.6.16.32, internalAddress: 10.6.16.32, user: root, password: xxx }
- { name: kbmaster, address: 10.6.16.191, internalAddress: 10.6.16.191, user: root, password: xxx }
roleGroups:
etcd:
- kbslave1
master:
- kbslave1
worker:
- kbslave1
- kbmaster
controlPlaneEndpoint:
##Internal loadbalancer for apiservers
#internalLoadbalancer: haproxy
##If the external loadbalancer was used, 'address' should be set to loadbalancer's ip.
domain: lb.kubesphere.local
address: ""
port: 6443
kubernetes:
version: v1.22.12
clusterName: cluster.local
proxyMode: ipvs
masqueradeAll: false
maxPods: 110
nodeCidrMaskSize: 24
network:
plugin: calico
kubePodsCIDR: 10.233.64.0/18
kubeServiceCIDR: 10.233.0.0/18
registry:
privateRegistry: ""
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 登录
Console: http://ip:30880
Account: admin
Password: P@88w0rd # 登录后会引导修改
1
2
3
2
3
# 监控
# 对单个k8s node节点进行监控
node-exporter-rqd5w
1
2
2
# 参考
上次更新: 2023-10-13 14:07:43