【云原生】使用KubeKey快速安装K8S和KubeSphere

1 篇文章 0 订阅
1 篇文章 0 订阅

一、推荐安装版本

  • K8S版本:1.21
  • KubeSphere版本:3.1.0

二、使用KubeSphere安装

利用KubeSphere提供KubeKey同时安装KubeSphere和K8S,安装步骤如下:

1. Update系统环境
yum -y update
2. 防火墙firewall的状态,如果启动的话,就关闭
firewall-cmd --state
3. 关闭防火墙
systemctl stop firewalld.service
4. 安装必要的插件
yum install -y socat
yum install -y conntrack
yum install -y ebtables
yum install -y ipset
5. 执行以下命令以确保默认策略为ACCEPT
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
6. 刷新防火墙规则
iptables -F
7.指定区域
export KKZONE=cn
8. 下载 KubeKey,具体版本可查看github
curl -sfL https://get-kk.kubesphere.io | VERSION=v2.0.0 sh -
9. 给权限
chmod +x kk
10. 使用 KubeKey 支持的 Kubernetes 版本,列出支持的版本命令如下
./kk version --show-supported-k8s
11. 指定版本安装(建议别指定最新的版本)
情况1:安装K8S时,如果节点的ssh端口为默认的22,则使用命令
./kk create cluster --with-kubernetes v1.21.5 --with-kubesphere v3.2.1
情况2:需要额外指定ssh端口,如22000,则使用命令
./kk create config --with-kubernetes v1.21.5 --with-kubesphere v3.2.1 -f config-sample.yaml

#修改配置文件 config-sample.yaml
vim config-sample.yaml

#修改点1:指定节点的port
192.168.133.167,port: 22000 ,user: root, password: ***

#修改点2:搜索 openpitrix,并将 enabled 的 false 改为 true,完成后保存文件。
12. 查看安装进度
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
13. 查看(报错)日志
journalctl -xeu kubelet 
journalctl -u flannel
journalctl  -ex  |grep  failed

三、其它命令

重新创建配置文件

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

列出 node 和pod

kubectl get nodes
kubectl get pod --all-namespaces

重启pod

kubectl scale deployment ks-controller-manager --replicas=0 -n kubesphere-systemjou	
kubectl scale deployment ks-controller-manager --replicas=1 -n kubesphere-system

四、相关资料

  • 在 Linux 上以 All-in-One 模式安装 KubeSphere:https://kubesphere.io/zh/docs/v3.3/quick-start/all-in-one-on-linux/
  • k8s官网搭建教程:https://kubernetes.io/zh/docs/setup/#learning-environment
  • linux命令:https://www.runoob.com/linux/linux-comm-chmod.html
  • docker命令:https://www.runoob.com/docker/centos-docker-install.html
  • kebusphere部署:https://blog.csdn.net/qq_37203082/article/details/123621531
  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值