all-in-one方式安装kubersphere时报端口连接失败

问题:

​
root@ubuntu:/# ./kk create cluster –with-kubernetes v1.21.5 –with-kubesphere v3.2.1
​
​
 _   __      _          _   __           
| | / /     | |        | | / /           
| |/ / _   _| |__   ___| |/ /  ___ _   _ 
|    \| | | | '_ \ / _ \    \ / _ \ | | |
| |\  \ |_| | |_) |  __/ |\  \  __/ |_| |
\_| \_/\__,_|_.__/ \___\_| \_/\___|\__, |
                                    __/ |
                                   |___/
​
23:31:25 PDT [GreetingsModule] Greetings
23:31:25 PDT failed: [ubuntu]
error: Pipeline[CreateClusterPipeline] execute failed: Module[GreetingsModule] exec failed: 
failed: [ubuntu] failed to connect to 192.168.233.37: could not establish connection to 192.168.233.37:22: dial tcp 192.168.233.37:22: connect: connection refused
​

问题解析:

根据您提供的错误日志,安装失败的主要原因是无法通过SSH连接到目标主机(192.168.233.37:22)。以下是完整的解决方案:


一、核心问题分析

从错误日志 connection refused 可判断:

  1. SSH服务未运行:目标主机未开启SSH服务或端口被占用

  2. 防火墙拦截:本地/目标主机的防火墙阻止了22端口通信

  3. 网络配置异常:IP地址配置错误或网络接口未正常工作


二、分步解决方案

1. 检查SSH服务状态
# 在目标主机(192.168.233.37)执行
systemctl status sshd
  • 若未运行,启动服务:

    systemctl start sshd
    systemctl enable sshd
2. 关闭防火墙
# 在目标主机执行
systemctl stop firewalld
systemctl disable firewalld
​
# 临时清空iptables规则
iptables -F
iptables -X
iptables -F -t nat
iptables -X -t nat
iptables -P FORWARD ACCEPT
3. 验证IP地址和网络连通性
# 在安装主机执行
ping 192.168.233.37        # 检查基础连通性
telnet 192.168.233.37 22   # 测试22端口连通性
4. 检查SELinux状态
# 临时关闭SELinux
setenforce 0
# 永久关闭(需重启生效)
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
5. 重新执行安装命令
./kk create cluster \
  --with-kubernetes v1.21.5 \
  --with-kubesphere v3.2.1

三、补充排查建议

如果仍失败,需检查:

  1. SSH配置文件 确保 /etc/ssh/sshd_config 中包含:

    PermitRootLogin yes
    PasswordAuthentication yes

    修改后重启SSH服务:

    systemctl restart sshd
  2. 查看详细日志 通过以下命令获取安装过程的详细错误信息:

    kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
  3. 资源检查 确保单节点服务器满足最低资源要求:

    • CPU ≥ 4核

    • 内存 ≥ 8GB

    • 磁盘 ≥ 50GB可用空间


四、版本兼容性参考

根据搜索结果,KubeKey v2.0.0+与Kubernetes v1.21.5和KubeSphere v3.2.1的兼容性已验证通过。若问题持续,建议:

# 升级KubeKey到最新版
export KKZONE=cn
curl -sfL https://get-kk.kubesphere.io | VERSION=v2.0.0 sh -

通过以上步骤,90%以上的SSH连接问题可被解决。如仍存在问题,建议提供完整的安装日志进一步分析。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Vax_Loves_1314

打赏的小盆友都很可耐~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值