gpt4 book ai didi

kubernetes - kubectl命令给出错误

转载 作者:行者123 更新时间:2023-12-02 11:54:34 27 4
gpt4 key购买 nike

我所有的kubectl get命令均失败,并出现以下错误The connection to the server localhost:8080 was refused - did you specify the right host or port?
我检查了/etc/kubernetes/admin.conf的ip,它具有以下内容:server: https://10.23.23.19:6443
因为那是我机器的IP,所以我想到了像kubectl get pods --server=10.23.23.19:6443这样运行命令

上面给了我错误-Unable to connect to the server: net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x15\x03\x01\x00\x02\x02"
我究竟做错了什么?我有一个3节点群集,所有这些都在主机上。当另外2个节点加入时,它们确实成功加入了,但我在屏幕上看到的是状态。

我使用了本教程(开始时略有偏差)-https://www.linuxtechi.com/install-kubernetes-1-7-centos7-rhel7/

最佳答案

/etc/kubernetes/admin.conf是预配置系统将您的配置放入的位置,但默认情况下不是kubectl使用的位置。 kubectl通常在配置时使用的是~/.kube/config,因此要么将您的配置文件放在此处,要么向kubectl提示它需要使用--kubeconfig <path>参数在其他位置查找。

关于kubernetes - kubectl命令给出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49086671/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com