欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 汽车 > 维修 > all-in-one方式安装kubersphere时报端口连接失败

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

2025/5/12 10:09:52 来源:https://blog.csdn.net/qq_41823684/article/details/147873184  浏览:    关键词: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连接问题可被解决。如仍存在问题,建议提供完整的安装日志进一步分析。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词